FFMPEG An Intermediate Guide/h.264

From Wikibooks, open books for an open world
Jump to navigation Jump to search

H.264 is arguably the cutting edge of video compression codecs. Unfortunately it is copyright protected. It is currently being used in formats such as Blu-ray, MP4, Flash (F4V), HTML5 and most modern portable devices. It is heavier on encoding and decoding than preceding formats but results in much higher picture quality from smaller files. It's not natively supported in ffmpeg, so you will need to build ffmpeg with support for the external library, x264.

Before using this in a production system please obtain the necessary licenses, you are warned!

Tests have shown this library functions comparatively if not more efficiently than Apple's Compressor or Episode, although both these programs have powerful features that ffmpeg does not have.

Basic ffmpeg call[edit | edit source]

To transcode a file using ffmpeg:

ffmpeg -i input -c:v libx264 output.mp4

To set the quality, use -crf 23, where lower is better, and values from 18-28 are considered a good range.

ffmpeg uses libx264's own preset system. To learn more about it and how presets affect the quality or encoding speed, check the H.264 encoding guide on the FFmpeg wiki. Note: Video/audio output can only be as good as the video/audio input. If your source is lossy so is your output.

Useful links[edit | edit source]


Guide on CRF values for x264