View Full Version : Question regarding FFmpeg-x264 presets and quality [SOLVED]

30th October 2008, 18:30
I always have a very recent FFmpeg (built today for instance) and am using
x264 r999 (patiently... waiting... and waiting). I started to experiment
with the x264 presets that are shipped with FFmpeg. My question is about
quality and input.

I mainly use x264 to encode my own artwork. All of the frames are GIMP
produced PNG files, so they're 24 bit images (no alpha). If I use the
normal, hq, or max presets nothing seems to change. 4077 frames using this
command line from Robert Swain's guide:
ffmpeg -i infile -vcodec libx264 -vpre hq -b 1M -bt 1M -threads 0 outfile.mp4
produces three files that are 48.8 MB in size with no discernible
difference in quality. Using the same three presets against a test movie
produces a huge difference both in quality and the amount of processing
power it takes to play back with Mplayer. Is this the expected behavior
when encoding from individual frames?

By the way, the same video using the gneneric line:
-coder 1 -flags +loop -cmp +chroma -partitions \
+parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 \
-keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -threads 0
at 2500 kbps produces an ~130 MB file with far lesser quality. Massive
improvement indeed!

As always, thanks to everyone working on x264 and FFmpeg. These are both
supreme pieces of software.

Dark Shikari
30th October 2008, 18:32
When encoding in bitrate mode, use twopass. If you don't care about an exact specific bitrate, you might want to use CRF mode (constant quality) instead.

30th October 2008, 18:51
Let me make a correction to what I said above. The input line is actually:
ffmpeg -i frame_%06d.png -vcodec libx264 -vpre hq -b 1M -bt 1M -threads 0 outfile4.mp4
My primary concern is about quality. Thanks DS, I'll play with CRF a bit and see how it does.

30th October 2008, 18:59
My primary concern is about quality.

Then find the highest possible CRF value that still produces acceptable quality for your eyes. And that's it!

30th October 2008, 19:10
Thanks for the advice to both of you. I tried CRF 24 and the resulting file was 15.5 MB. The quality was still good. I'll go down from there, but it's very promising.

This is a such an awesome forum. It'd be cool if more of you were Arch Linux users. It's a great place too.