FFmpeg - Encode AVC: Difference between revisions

From PiRho Knowledgebase
Jump to navigationJump to search
mNo edit summary
Dex (talk | contribs)
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= FFmpeg – Encode AVC (H.264) Using CRF =
[[Category:FFmpeg]]
[[Category:FFmpeg]]
[[Category:AVC]]
[[Category:AVC]]
Use this rate control mode if you want to keep the best quality and care less about the file size. This is the recommended rate control mode for most uses.<br/>
 
This method allows the encoder to attempt to achieve a certain output quality for the whole file when output file size is of less importance. The downside is that you can't tell it to get a specific filesize or not go over a specific size or bitrate, which means that this method is not recommended for encoding videos for streaming.<br/>
== Summary ==
The range of the CRF scale is 0–51, where 0 is lossless. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless.<br/>
This article explains how to encode H.264/AVC video using CRF (Constant Rate Factor) with FFmpeg. CRF is the recommended rate‑control mode for most workflows because it prioritises consistent visual quality over exact file size.
A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize).<br/>
 
== What CRF Is ==
CRF is a quality‑targeted encoding mode. Instead of telling the encoder how big the output must be, you tell it what quality level you want, and the encoder decides the bitrate dynamically across the entire video.
 
== CRF Scale Explained ==
The CRF scale ranges from 0 to 51.
 
== Presets ==
Presets determine the speed/compression ratio balance.
 
== Example Command ==
<pre>
<pre>
ffmpeg -i <input.file> -c:v libx264 -crf 23 -preset veryslow <output.file>
ffmpeg -i input.file -c:v libx264 -crf 23 -preset veryslow output.file
</pre>
</pre>
Reference: [[https://trac.ffmpeg.org/wiki/Encode/H.264 FFmpeg: H.264 Video Encoding Guide]]
 
== References ==
* https://trac.ffmpeg.org/wiki/Encode/H.264

Latest revision as of 13:48, 14 March 2026

FFmpeg – Encode AVC (H.264) Using CRF

Summary

This article explains how to encode H.264/AVC video using CRF (Constant Rate Factor) with FFmpeg. CRF is the recommended rate‑control mode for most workflows because it prioritises consistent visual quality over exact file size.

What CRF Is

CRF is a quality‑targeted encoding mode. Instead of telling the encoder how big the output must be, you tell it what quality level you want, and the encoder decides the bitrate dynamically across the entire video.

CRF Scale Explained

The CRF scale ranges from 0 to 51.

Presets

Presets determine the speed/compression ratio balance.

Example Command

ffmpeg -i input.file -c:v libx264 -crf 23 -preset veryslow output.file

References