[Ffmpeg-devel] Re: Degradation of x264 encoding in my build of ffmpeg

William Ross william.ross
Sun Dec 25 23:54:13 CET 2005


Laine Lee <laine.lee <at> utsa.edu> writes:

> 
> I'm using Mac OS X 10.4.3 and my own build of the most recent version of
> ffmpeg (from CVS today). I'm trying to find out why my build of ffmpeg
> yields deprecated results as compared to the results I get when I use the
> build included with ffmpegX to feed a an encoding command to x264. The
> command encodes a .VOB file to a .mp4 file. When I use the following
> commands to create h.264 video output from ffmpeg, the output from my build
> yields a video whose deficiency is mainly visible in that the picture rolls
> horizontally and increasingly migrates toward the bottom of the frame
> leaving an area of green at the top of the frame.
> 
> The command  is this:
> 
> '/Users/llee/Library/Application Support/No Frills DVD2iPod/ffmpeg' -i
> '/Users/llee/Desktop/No Frills DVD2iPod/Goblin.VOB' -an -f yuv4mpegpipe
> -croptop 0 -cropbottom 0 -cropleft 0 -cropright 0 -s 320x176 -r 29.97 - |
> '/Users/llee/Library/Application Support/No Frills DVD2iPod/x264' -A i4x4
> --no-cabac -b 0 --qpmin 10 --qpmax 51 -B 215 --me hex --threads 2 --level 13
> --fps 29.97 -o 
> '/private/var/tmp/folders.501/TemporaryItems/1/Goblin.vid.mp4' - 320x176
> 
> The results generated by x.264 when the command is passed by the ffmpegX
> version of the executable that didn't deprecate quality are these:
> 
> frame=   99 q=0.0 Lsize=    8168kB time=3.3 bitrate=20254.9kbits/s
> video:0kB audio:0kB global headers:0kB muxing overhead inf%
> x264 [info]: slice I:1     Avg QP:21.00  size: 15041  PSNR Mean Y:42.01
> U:44.36 V:44.34 Avg:42.66 Global:42.66
> x264 [info]: slice P:98    Avg QP:29.84  size:   829  PSNR Mean Y:34.34
> U:39.57 V:39.13 Avg:35.45 Global:35.37
> x264 [info]: mb I  I16..4:  7.3%  0.0% 92.7%
> x264 [info]: mb P  I16..4:  0.1%  0.0%  0.4%  P16..4: 52.7%  0.0%  0.0%
> 0.0%  0.0%    skip:46.9%
> x264 [info]: final ratefactor: 27.54
> x264 [info]: PSNR Mean Y:34.417 U:39.620 V:39.180 Avg:35.525 Global:35.409
> kb/s:233.21
> 
> The results generated by x.264 when the command is passed by my build of the
> executable that deprecated quality are these:
> 
> frame=   99 q=0.0 Lsize=    8168kB time=3.3 bitrate=20256.5kbits/s
> video:0kB audio:0kB global headers:0kB muxing overhead inf%
> x264 [info]: slice I:1     Avg QP:21.00  size: 15163  PSNR Mean Y:41.98
> U:44.39 V:44.38 Avg:42.65 Global:42.65
> x264 [info]: slice P:98    Avg QP:34.57  size:   823  PSNR Mean Y:31.17
> U:34.83 V:34.53 Avg:32.03 Global:31.91
> x264 [info]: mb I  I16..4:  3.2%  0.0% 96.8%
> x264 [info]: mb P  I16..4:  7.6%  0.0%  1.5%  P16..4: 69.6%  0.0%  0.0%
> 0.0%  0.0%    skip:21.4%
> x264 [info]: final ratefactor: 31.93
> x264 [info]: PSNR Mean Y:31.274 U:34.929 V:34.629 Avg:32.139 Global:31.955
> kb/s:231.94
> 
> My build of ffmpeg uses precisely the same configuration options indicated
> in the version of ffmpeg included with ffmpegX. Please tell me what might be
> causing the difference in output that results in the degradation. Thanks.
> 

Instead of -f yuv4mpegpipe use -f rawvideo
That works for me within a script like so:

#!/bin/tcsh
foreach input (*.avi)
set base="$input:r"
ffmpeg -i "$input" -f rawvideo -r 25 -s 368x208 - | x264 -B 225 --fps 25 -m 4 
--me hex --level 1.3 --no-cabac --vbv-maxrate 768 --vbv-bufsize 2000 -p 1
--stats "${base}.log" -o "${base} pass 1.264" - 368x208
rm "${base} pass 1.264"
ffmpeg -i "$input" -f rawvideo -r 25 -s 368x208 - | x264 -B 225 --fps 25 -m 4
--me hex --level 1.3 --no-cabac --vbv-maxrate 768 --vbv-bufsize 2000 -p 2
--stats "${base}.log" -o "${base}.264" - 368x208
rm "${base}.log"

mp4creator -c "${base}.264" -rate=25 "${base}.mp4"

ffmpeg -i "$input" -f wav -ar 32000 -ac 1 - | faac -b 32 -c 32000 --mpeg-vers 4 
-o "${base}.aac" -
mp4creator -c "${base}.aac" -aac-profile=4 "${base}.mp4"
end

This script creates 2 pass ipod compatible mp4's in 16:9 ratio.

Hope that helps,

William








More information about the ffmpeg-devel mailing list