如何使用avconv将mp4文件转换为avi?


8

我需要将一些mp4文件转换为另一种格式(我选择了avi:可能会有更好的格式,欢迎提出建议)。我尝试使用ffmpeg,但收到了已弃用的消息,因此我正在使用avconv,但再次可能有更好的工具。

这是我正在使用的: avconv -i e2.mp4 -vtag libxvid -b:v 1500k e2.avi

这给了我以下输出:

avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:09:46 with gcc 4.8.1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1c677a0] multiple edit list entries, a/v desync might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'e2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf53.21.1
    media_type      : 10
    copyright       : � 2014 British Broadcasting Corporation, all rights reserved
    title           : Episode 2
    artist          : BBC Four
    album_artist    : BBC TV
    album           : The Bridge: Series 2
    composer        : BBC iPlayer
    genre           : Drama
    comment         : Online, four individuals in masks use signs to claim responsibility for the plague.
    date            : 2014-01-04T22:00:00Z
    track           : 2
    disc            : 2
    description     : Online, four individuals in masks use signs to claim responsibility for the plague.
    show            : The Bridge: Series 2
    episode_id      : s02e02
    season_number   : 2
    episode_sort    : 2
    network         : BBC Four
  Duration: 00:57:38.16, start: 0.000000, bitrate: 2399 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 2298 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 93 kb/s
[buffer @ 0x1c69260] w:1280 h:720 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 @ 0x1c2a160] invalid bit rate
Output #0, avi, to 'e2.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf53.21.1
    media_type      : 10
    copyright       : � 2014 British Broadcasting Corporation, all rights reserved
    title           : Episode 2
    artist          : BBC Four
    album_artist    : BBC TV
    album           : The Bridge: Series 2
    composer        : BBC iPlayer
    genre           : Drama
    comment         : Online, four individuals in masks use signs to claim responsibility for the plague.
    date            : 2014-01-04T22:00:00Z
    track           : 2
    disc            : 2
    description     : Online, four individuals in masks use signs to claim responsibility for the plague.
    show            : The Bridge: Series 2
    episode_id      : s02e02
    season_number   : 2
    episode_sort    : 2
    network         : BBC Four
    Stream #0.0(und): Video: mpeg4, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], q=2-31, 1500 kb/s, 90k tbn, 25 tbc
    Stream #0.1(und): Audio: ac3, 48000 Hz, stereo, flt, 200 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (aac -> ac3)
Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

我也得到了一个e2.avi文件,它是空的。我以前没有使用过avconv-这样做的正确方法是什么?如果需要,我可以发布更多详细信息。

提前致谢!


它告诉您“编解码器'ac3'的样本格式不兼容's16',自动选择格式'flt'”和“打开输出流#0:1的编码器时出错-可能是不正确的参数,例如bit_rate,rate,width或高度”。这意味着它找到了您的输入文件,但无法设置输出文件。阅读man avconv
waltinator 2014年

Answers:


8

由于AVI只是保存数据的容器,因此转换视频的最快方法是仅复制已编码的音频和视频流。默认情况下不执行此操作。要强制复制流,我们可以使用以下选项-c

avconv -i infile.mp4 -c:a copy -c:v copy outfile.avi

当然,只能以这种方式复制AVI容器支持的视频编码。

要对输出视频进行重新编码,我们可以用from中copy列出的任何受支持的编解码器代替E

avconv -codecs
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.