使用 avconv 将 mp4 转换为 Xvid avi?

使用 avconv 将 mp4 转换为 Xvid avi?

我通常使用 avidemux 将 mp4 转换为 Xvid AVI,用于我的飞利浦 Streamium SLM5500。通常,我会选择 Two Pass 的 MPEG-4 ASP (Xvid),视频和 AC3 (lav) 音频的平均比特率为 1500kb/s,转换正确。

但是,我尝试使用 avconv,以便使用脚本自动执行该过程,但当我这样做时,视频会卡顿并停止播放。我怀疑这与音频转换故障有关。

我使用的命令如下:

avconv -y -i video.mp4 -pass 1 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi /dev/null
avconv -y -i video.mp4 -pass 2 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi video.avi

avconv 的参数多得让人眼花缭乱。我是不是做错了什么?有没有办法从无头服务器编写 avidemux 脚本?

请查看命令行输出:

$ avconv -y -i video.mp4 -pass 1 -vtag xvid -an -b:v 1500k -f avi /dev/null
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:49:20 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
  Duration: 00:44:09.16, start: 0.000000, bitrate: 669 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 538 kb/s, 25 fps, 25 tbr, 100 tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, s16, 127 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
[buffer @ 0x7f4c40] w:720 h:404 pixfmt:yuv420p
Output #0, avi, to '/dev/null':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
    ISFT            : Lavf53.21.1
    Stream #0.0(und): Video: mpeg4, yuv420p, 720x404 [PAR 1:1 DAR 180:101], q=2-31, pass 1, 1500 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
Press ctrl-c to stop encoding
frame=66227 fps=328 q=2.0 Lsize=       0kB time=2649.16 bitrate=   0.0kbits/s    
video:401602kB audio:0kB global headers:0kB muxing overhead -100.000000%
$ avconv -y -i video.mp4 -pass 2 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi video.avi
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:49:20 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
  Duration: 00:44:09.16, start: 0.000000, bitrate: 669 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 538 kb/s, 25 fps, 25 tbr, 100 tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, s16, 127 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
[buffer @ 0x12b4f00] w:720 h:404 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[mpeg4 @ 0x12b3ec0] [lavc rc] Using all of requested bitrate is not necessary for this video with these parameters.
Output #0, avi, to 'video.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
    ISFT            : Lavf53.21.1
    Stream #0.0(und): Video: mpeg4, yuv420p, 720x404 [PAR 1:1 DAR 180:101], q=2-31, pass 2, 1500 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, flt, 128 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press ctrl-c to stop encoding
Input stream #0:1 frame changed from rate:44100 fmt:s16 ch:2 to rate:44100 fmt:flt ch:2
frame=66227 fps=284 q=2.2 Lsize=  458486kB time=2649.13 bitrate=1417.8kbits/s    
video:413716kB audio:41393kB global headers:0kB muxing overhead 0.741969%

答案1

经过多次尝试后,您应该在第 1 次尝试时使用 -an 选项停用音频,因此:

avconv -y -i video.mp4 -pass 1 -vtag libxvid -an -b:v 1500k -f avi /dev/null

答案2

根据制造商的说法,飞利浦 SLM5500 最好与以下任一产品结合使用:WMA 或 MPEG 视频

基于该假设,您可以轻松地对 avconv 使用以下内容:

avconv -i video.mp4 -c:v mpeg2video -b:v 1500k -c:a mp2 video.mpg

这应该足以让您开始,您可以根据需要调整两次通过的设置。

相关内容