2011-04-07 355 views
2

我使用命令:YUV到MP4轉換

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 

如果有人有任何想法,那什麼錯誤,plz幫助。

回答

0

我認爲這是因爲你的輸出比特率(128kb)高於你的輸入比特率(106 kb)。

我剛剛做了一個快速測試,當我把我的輸出高於我的輸入時,我的失敗與你的錯誤一樣 - 當我再次降低它時成功。

這也許可以解釋爲什麼它只對某些輸入失敗。

如果您以某種方式編寫腳本,您必須先使用'ffmpeg -i'或MediaInfo之類的內容來先分析您的輸入源並進行相應調整。