[FFmpeg-user] mpeg4 better than libx264?

dE . de.techno at gmail.com
Fri Jan 13 05:29:05 CET 2012


I converted a sample input video to mpeg4 (avi) using -

ffmpeg -t 00:05:00 -i input.avi -vf scale='320:trunc((320/a)/2)*2' 
-threads 10 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 
-pass 1 -b 20000k -vcodec mpeg4 -an -vtag xvid movie.avi
ffmpeg version N-36445-gc4eec85, Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Jan  5 2012 01:11:11 with gcc 4.5.3
   configuration: --prefix=/usr --libdir=/usr/lib64 
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared 
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ 
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --extra-cflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --extra-cxxflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --disable-static --enable-gpl --enable-version3 
--enable-postproc --enable-avfilter --disable-stripping --disable-debug 
--disable-doc --disable-network --disable-vaapi --disable-vdpau 
--enable-libmp3lame --enable-libvo-aacenc --enable-libvo-amrwbenc 
--enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid 
--enable-libaacplus --enable-nonfree --enable-openal --disable-indev=v4l 
--disable-indev=v4l2 --disable-indev=oss --disable-i  libavutil      51. 
34.100 / 51. 34.100
   libavcodec     53. 53.100 / 53. 53.100
   libavformat    53. 29.100 / 53. 29.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 57.101 /  2. 57.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  5.100 /  0.  5.100
   libpostproc    51.  2.100 / 51.  2.100
Input #0, avi, from '/home/de/input.avi':
   Metadata:
     encoder         : MEncoder SVN-r30819-4.4.1
   Duration: 01:34:02.04, start: 0.000000, bitrate: 733 kb/s
     Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), 
yuv420p, 640x296 [SAR 1:1 DAR 80:37], SAR 37888:35655 DAR 16384:7131, 25 
tbr, 25 tbn, 25 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 
s16, 32 kb/s
Please use -b:a or -b:v, -b is ambiguous
[buffer @ 0x14eece0] w:640 h:296 pixfmt:yuv420p tb:1/1000000 
sar:37888/35655 sws_param:
[scale @ 0x14bb9b0] w:640 h:296 fmt:yuv420p -> w:320 h:148 fmt:yuv420p 
flags:0x4
[mpeg4 @ 0x14ef4b0] Invalid pixel aspect ratio 37888/35655, limit is 
255/255 reducing
Output #0, avi, to 'movie.avi':
   Metadata:
     ISFT            : Lavf53.29.100
     Stream #0:0: Video: mpeg4 (hq) (xvid / 0x64697678), yuv420p, 
320x148 [SAR 17:16 DAR 85:37], q=2-31, pass 1, 20000 kb/s, SAR 
37888:35655 DAR 16384:7131, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)
Press [q] to stop, [?] for help
frame= 7421 fps=163 q=2.0 Lsize=    7497kB time=00:05:00.00 bitrate= 
204.7kbits/s
video:7312kB audio:0kB global headers:0kB muxing overhead 2.529918%

The result is a 7.4M video.

Now, I converted the same clip to h264 using the veryslow preset -

ffmpeg -t 00:05:00 -i input.avi -vf scale='320:trunc((320/a)/2)*2' 
-threads 10 -pass 1 -preset veryslow -b 20000k -vcodec libx264 -an 
movie_264.avi
ffmpeg version N-36445-gc4eec85, Copyright (c) 2000-2012 the FFmpeg 
developers
   built on Jan  5 2012 01:11:11 with gcc 4.5.3
   configuration: --prefix=/usr --libdir=/usr/lib64 
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared 
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ 
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --extra-cflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --extra-cxxflags='-march=native -O2 
-fomit-frame-pointer -floop-interchange -floop-strip-mine -floop-block 
-fgraphite-identity' --disable-static --enable-gpl --enable-version3 
--enable-postproc --enable-avfilter --disable-stripping --disable-debug 
--disable-doc --disable-network --disable-vaapi --disable-vdpau 
--enable-libmp3lame --enable-libvo-aacenc --enable-libvo-amrwbenc 
--enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid 
--enable-libaacplus --enable-nonfree --enable-openal --disable-indev=v4l 
--disable-indev=v4l2 --disable-indev=oss --disable-i  libavutil      51. 
34.100 / 51. 34.100
   libavcodec     53. 53.100 / 53. 53.100
   libavformat    53. 29.100 / 53. 29.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 57.101 /  2. 57.101
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  5.100 /  0.  5.100
   libpostproc    51.  2.100 / 51.  2.100
Input #0, avi, from '/home/de/game/temp(game)/input.avi':
   Metadata:
     encoder         : MEncoder SVN-r30819-4.4.1
   Duration: 01:34:02.04, start: 0.000000, bitrate: 733 kb/s
     Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), 
yuv420p, 640x296 [SAR 1:1 DAR 80:37], SAR 37888:35655 DAR 16384:7131, 25 
tbr, 25 tbn, 25 tbc
     Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, 
s16, 32 kb/s
Please use -b:a or -b:v, -b is ambiguous
File 'movie_264.avi' already exists. Overwrite ? [y/N] y
w:640 h:296 pixfmt:yuv420p tb:1/1000000 sar:37888/35655 sws_param:
[scale @ 0x1029470] w:640 h:296 fmt:yuv420p -> w:320 h:148 fmt:yuv420p 
flags:0x4
[libx264 @ 0x10600e0] using SAR=2596/2443
[libx264 @ 0x10600e0] using cpu capabilities: MMX2 SSE2Slow SlowCTZ
[libx264 @ 0x10600e0] profile Main, level 4.1
Output #0, avi, to 'movie_264.avi':
   Metadata:
     ISFT            : Lavf53.29.100
     Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 320x148 [SAR 
37888:35655 DAR 16384:7131], q=-1--1, pass 1, 20000 kb/s, 25 tbn, 25 tbc
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg4 -> libx264)
Press [q] to stop, [?] for help
frame= 7421 fps=128 q=32639.0 Lsize=   58633kB time=00:04:59.92 
bitrate=1601.5kbits/s
video:58448kB audio:0kB global headers:0kB muxing overhead 0.316463%
[libx264 @ 0x10600e0] frame I:45    Avg QP: 0.05  size: 10788
[libx264 @ 0x10600e0] frame P:2562  Avg QP: 0.05  size:  8437
[libx264 @ 0x10600e0] frame B:4814  Avg QP: 0.41  size:  7842
[libx264 @ 0x10600e0] consecutive B-frames: 11.4% 12.0% 12.0% 31.2% 
17.2% 11.5%  2.7%  1.0%  1.1%
[libx264 @ 0x10600e0] mb I  I16..4: 41.3%  0.0% 58.7%
[libx264 @ 0x10600e0] mb P  I16..4: 20.5%  0.0%  0.0%  P16..4: 66.1%  
0.0%  0.0%  0.0%  0.0%    skip:13.4%
[libx264 @ 0x10600e0] mb B  I16..4:  3.7%  0.0%  0.0%  B16..8: 48.6%  
0.0%  0.0%  direct:34.6%  skip:13.1%  L0:35.3% L1:37.1% BI:27.6%
[libx264 @ 0x10600e0] final ratefactor: -27.27
[libx264 @ 0x10600e0] direct mvs  spatial:99.2% temporal:0.8%
[libx264 @ 0x10600e0] coded y,uvDC,uvAC intra: 74.0% 60.3% 55.6% inter: 
67.5% 59.0% 57.3%
[libx264 @ 0x10600e0] i16 v,h,dc,p: 50% 24% 21%  6%
[libx264 @ 0x10600e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 20% 19%  2%  
6%  6%  4%  4%  5%
[libx264 @ 0x10600e0] i8c dc,h,v,p: 68% 15% 15%  2%
[libx264 @ 0x10600e0] Weighted P-Frames: Y:11.2% UV:1.7%
[libx264 @ 0x10600e0] kb/s:1596.01

The result is ~60MB.

Am I missing something here? =-O


More information about the ffmpeg-user mailing list