我的GIF动画大约是37mo,持续大约10秒。我在debian上使用以下命令将其转换为.mp4:
avconv -i test2_37m2.gif -pix_fmt yuv420p -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" test2_37m2_mp4.mp4 2>&1
结果是14kb .mp4,它只是gif的静态帧(第一个)。为什么?
这是ffmpeg / avconv
的输出日志avconv version 0.8.18-6:0.8.18-0+deb7u1, Copyright (c) 2000-2014 the Libav developers
built on Oct 4 2016 17:59:06 with gcc 4.7.2
Input #0, image2, from '/var/www/clients/client1/web1/web/test/gif/test2_37m2.gif':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #0.0: Video: gif, pal8, 640x360, 25 tbr, 25 tbn, 25 tbc
Incompatible pixel format 'pal8' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0x1a4a820] w:640 h:360 pixfmt:pal8
[avsink @ 0x1a4aac0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1a4ae20] w:640 h:360 fmt:pal8 -> w:640 h:360 fmt:yuv420p flags:0x4
[libx264 @ 0x1a4a060] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x1a4a060] profile Main, level 3.0
[libx264 @ 0x1a4a060] 264 - core 123 r2189 35cf912 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=0 open_gop=1 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.25 aq=1:1.00
Output #0, mp4, to '/var/www/clients/client1/web1/web/test/gif/test2_37m2_mp4.mp4':
Metadata:
encoder : Lavf53.21.1
Stream #0.0: Video: libx264, yuv420p, 640x360, q=-1--1, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (gif -> libx264)
Press ctrl-c to stop encoding
frame= 1 fps= 0 q=28.0 Lsize= 13kB time=10000000000.00 bitrate= 0.0kbits/s
video:12kB audio:0kB global headers:0kB muxing overhead 6.292888%
[libx264 @ 0x1a4a060] frame I:1 Avg QP:27.23 size: 12119
[libx264 @ 0x1a4a060] mb I I16..4: 49.2% 0.0% 50.8%
[libx264 @ 0x1a4a060] coded y,uvDC,uvAC intra: 68.7% 45.8% 3.4%
[libx264 @ 0x1a4a060] i16 v,h,dc,p: 22% 25% 22% 31%
[libx264 @ 0x1a4a060] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 28% 21% 4% 5% 4% 9% 3% 7%
[libx264 @ 0x1a4a060] i8c dc,h,v,p: 57% 29% 13% 1%
[libx264 @ 0x1a4a060] kb/s:2423.80
谢谢