[FFmpeg-user] How to get good x264 compression?

Lou lou at lrcd.com
Sat May 12 02:15:42 CEST 2012


On Wed, 9 May 2012 11:05:37 -0700 (PDT)
texastwister <scott_purcell at dell.com> wrote:

> Several years ago, I started editing HD video from the Flip video camera down
> to a lower (but still HD) resolution to save space.  This invocation worked
> well and gave good conversion results -- no significant degradation of
> quality:
> 
>     ffmpeg -threads 2 -i "$ORIG" -s hd480 -vcodec libx264 -acodec copy
> "$NEW"
> 
> When I try that with my current version of ffmpeg (FFmpeg version
> 0.6.4-4:0.6.4-0ubuntu0.11.04.1, Copyright (c) 2000-2010 the Libav developers

The above line indicates that you are using "ffmpeg" (now called
"avconv") from a fork, and not ffmpeg from the FFmpeg project.
Obviously we support ffmpeg here and I have no experience with avconv.

For a complete guide to get ffmpeg in Ubuntu see:
https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

Then you can try:
    ffmpeg -i "$ORIG" -s hd480 -vcodec libx264 -acodec copy "$NEW"

This will use the default settings for preset (medium) and crf value
(23). You can easily change them to suit your needs:
    ffmpeg -i "$ORIG" -s hd480 -vcodec libx264 -preset slow -crf 20 \
    -acodec copy "$NEW"

General usage is to use the slowest preset you have patience for and
the highest crf value that still gives you an acceptable quality.
Available presets are: ultrafast, superfast, veryfast, faster, fast,
medium, slow, slower, veryslow. I omitted the "placebo" preset because
it is a joke and a complete waste of time. A sane crf value range is
18-28 (a lower value is higher quality), but of course it depends on
your source and whatever needs and restrictions you have on your output.

The "-threads 0" option is now redundant as it is now automatically
applied.


More information about the ffmpeg-user mailing list