FFmpeg Command for rav1e AV1 Encoder
This guide provides the exact FFmpeg command required to encode video using the rav1e AV1 encoder. You will learn the basic command syntax, essential configuration parameters like quality and speed, and how to verify that your FFmpeg installation supports the rav1e library.
Verify rav1e Support in FFmpeg
Before running the command, ensure your FFmpeg build is compiled with rav1e support. Run the following command in your terminal:
ffmpeg -encoders | grep rav1eIf supported, you will see librav1e listed in the
output.
The Basic FFmpeg rav1e Command
To encode a video to AV1 using the rav1e encoder, use the following basic command structure:
ffmpeg -i input.mp4 -c:v librav1e -qp 80 -speed 5 -c:a copy output.mkvParameter Breakdown
-i input.mp4: Specifies the path to your source video file.-c:v librav1e: Selects the rav1e encoder for the video stream.-qp 80: Sets the Quantizer Parameter (quality level). The scale ranges from 0 to 255. Lower values yield higher quality and larger file sizes, while higher values result in lower quality and smaller file sizes. A value between 50 and 100 is recommended for general use.-speed 5: Adjusts the encoding speed and efficiency on a scale from 0 to 10. Level 0 is the slowest (best compression efficiency), and level 10 is the fastest (lowest compression efficiency).-c:a copy: Copies the audio stream directly from the source without re-encoding to save time and preserve original audio quality.output.mkv: The path and format of the output file. While Matroska (.mkv) is highly recommended for AV1, you can also use MP4 (.mp4) or WebM (.webm).
Alternative: Encoding with a Target Bitrate
If you prefer to target a specific file size or bandwidth limit
instead of using a constant quality (-qp), you can set a
target video bitrate using -b:v:
ffmpeg -i input.mp4 -c:v librav1e -b:v 2M -speed 5 -c:a copy output.mkvIn this command, -b:v 2M sets the video target bitrate
to 2 Megabits per second (Mbps).