Encoding h.264 is even easier with modern (2012) FFmpeg. You can use the following command line options to control most aspects of h.264 encoding:
- -profile:v <x264 profile>
- -preset:v <x264 preset>
- -tune:v <x264 tuning>
- -level <level>
- -x264opts <opts>
For example, if you want a video at Main@L3.1, then you can construct a command line like this:
ffmpeg -i <input> -c:v libx264 -profile:v main -preset:v fast -level 3.1 <output>
If that is too slow, you can go faster with the preset.
If you want to improve the quality of the encode, or reduce the bitrate of the encode, you can lower or higher the crf. A lower crf will give higher quality, at a higher bitrate, and a higher crf will give you lower quality, at a lower bitrate.
ffmpeg -i <input> -c:v libx264 -profile:v main -preset:v fast -level 3.1 -x264opts crf=18 <output>
The faster the preset you use, the less efficient the encoding is. FFmpeg will use a higher bitrate to achieve the same quality as a slower encode.
profile
- baseline
- main
- high
- high10
preset
- ultrafast
- superfast
- veryfast
- faster
- fast
- medium
- slow
- slower
- veryslow
- placebo
tune
- film
- grain
- stillimage
- psnr
- ssim
- fastdecode
- zerolatency