YUV转换为mp4

时间:2011-04-07 08:00:25

标签: macos ffmpeg h.264

我正在使用命令:

ffmpeg -i MovieTest.yuv -vcodec libx264 -b 1200kb -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 128kb output.mp4 

对于yuv到mp4的转换。 这里MovieTest.yuv是我的输入文件,output.mp4是我的输出文件。 我正在使用h.264编解码器(libx264)进行转换。

它可以正确转换我的大部分yuv文件。 但有时,转换会因终端错误而失败:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '‪MovieTest.yuv‬':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
  Duration: 00:00:06.45, start: 0.000000, bitrate: 109786 kb/s
    Stream #0.0(und): Video: rawvideo, uyvy422, 640x480, 109675 kb/s, 22.31 fps, 27.25 tbr, 30k tbn, 30k tbc
    Stream #0.1(und): Audio: aac, stereo, s16, 106 kb/s
[libx264 @ 0x12180da00]using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x12180da00]profile High, level 3.0
[libx264 @ 0x12180da00]264 - core 98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2010 - http://www.videolan.org/x264.html - options: cabac=1 ref=6 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=0 weightp=0 keyint=12 keyint_min=7 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=120 ratetol=33.3 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00
[libfaac @ 0x12180e000]libfaac doesn't support this output format!
Output #0, mp4, to 'output.mp4':
    Stream #0.0(und): Video: libx264, yuv420p, 640x480, q=10-51, 120 kb/s, 90k tbn, 27.25 tbc
    Stream #0.1(und): Audio: libfaac, stereo, s16, 128 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

如果有人有任何想法,那就出错了,请帮助。

1 个答案:

答案 0 :(得分:0)

我认为这是因为您的输出比特率(128kb)高于输入比特率(106 kb)。

我刚刚做了一个快速测试,当我输出的输出高于我的输入时,我的输出失败并出现与你相同的错误 - 当我再次降低它时它会成功。

这可以解释为什么它只会失败一些输入。

如果您以某种方式编写脚本,则必须先使用“ffmpeg -i”或类似MediaInfo的内容来分析输入源并进行相应调整。

相关问题