Encode/AV1 – FFmpeg (2024)

Contents

  1. libaom
    1. Constant Quality
    2. Constrained Quality
    3. Two-Pass
    4. Average Bitrate (ABR)
    5. Controlling Speed / Quality
    6. Keyframe placement
    7. HDR and high bit depth
    8. Lossless encoding
  2. SVT-AV1
    1. CRF
    2. Presets and tunes
    3. Keyframe placement
    4. Film grain synthesis
  3. rav1e
  4. Additional Resources

AV1 is an open source & royalty-free video codec developed by the Alliance for Open Media (AOMedia), a non-profit industry consortium. Depending on the use case, AV1 can achieve about 30% higher compression efficiency than VP9, and about 50% higher efficiency than H.264.

There are currently three AV1 encoders supported by FFmpeg: libaom (invoked with libaom-av1 in FFmpeg), SVT-AV1 (libsvtav1), and rav1e (librav1e). This guide currently focuses on libaom and SVT-AV1.

libaom (libaom-av1) is the reference encoder for the AV1 format. It was also used for research during the development of AV1. libaom is based on libvpx and thus shares many of its characteristics in terms of features, performance, and usage.

To install FFmpeg with support for libaom-av1, look at the Compilation Guides and compile FFmpeg with the --enable-libaom option.

libaom offers the following rate-control modes which determine the quality and file size obtained:

  • Constant quality
  • Constrained quality
  • 2-pass average bitrate
  • 1-pass average bitrate

For a list of options, run ffmpeg -h encoder=libaom-av1 or check FFmpeg's online documentation. For options that can be passed via -aom-params, checking the --help output of the aomenc application is recommended, as there is currently no official online reference for them.

Note: Users of libaom older than version 2.0.0 will need to add -strict experimental (or the alias -strict -2).

Constant Quality

libaom-av1 has a constant quality (CQ) mode (like CRF in x264 and x265) which will ensure that every frame gets the number of bits it deserves to achieve a certain (perceptual) quality level, rather than encoding each frame to meet a bit rate target. This results in better overall quality. If you do not need to achieve a fixed target file size, this should be your method of choice.

To trigger this mode, simply use the -crf switch along with the desired numerical value.

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 av1_test.mkv

The CRF value can be from 0–63. Lower values mean better quality and greater file size. 0 means lossless. A CRF value of 23 yields a quality level corresponding to CRF 19 for x264 (source), which would be considered visually lossless.

Note that in FFmpeg versions prior to 4.3, triggering the CRF mode also requires setting the bitrate to 0 with -b:v 0. If this is not done, the -crf switch triggers the constrained quality mode with a default bitrate of 256kbps.

Constrained Quality

libaom-av1 also has a constrained quality (CQ) mode that will ensure that a constant (perceptual) quality is reached while keeping the bitrate below a specified upper bound or within a certain bound. This method is useful for bulk encoding videos in a generally consistent fashion.

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -b:v 2000k output.mkv

The quality is determined by the -crf, and the bitrate limit by the -b:v where the bitrate MUST be non-zero.

You can also specify a minimum and maximum bitrate instead of a quality target:

ffmpeg -i input.mp4 -c:v libaom-av1 -minrate 500k -b:v 2000k -maxrate 2500k output.mp4

Note: When muxing into MP4, you may want to add -movflags +faststart to the output parameters if the intended use for the resulting file is streaming.

Two-Pass

In order to create more efficient encodes when a particular target bitrate should be reached, you should choose two-pass encoding. Two-pass encoding is also beneficial for encoding efficiency when constant quality is used without a target bitrate. For two-pass, you need to run ffmpeg twice, with almost the same settings, except for:

  • In pass 1 and 2, use the -pass 1 and -pass 2 options, respectively.
  • In pass 1, output to a null file descriptor, not an actual file. (This will generate a logfile that FFmpeg needs for the second pass.)
  • In pass 1, you can leave audio out by specifying -an.
ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -pass 1 -an -f null /dev/null && \ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -pass 2 -c:a libopus output.mkv

Note: Windows users should use NUL instead of /dev/null and ^ instead of \.

Average Bitrate (ABR)

libaom-av1 also offers a simple "Average Bitrate" or "Target Bitrate" mode. In this mode, it will simply try to reach the specified bit rate on average, e.g. 2 MBit/s.

ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M output.mkv

Use this option only if file size and encoding time are more important factors than quality alone. Otherwise, use one of the other rate control methods described above.

Controlling Speed / Quality

-cpu-used sets how efficient the compression will be. Default is 1. Lower values mean slower encoding with better quality, and vice-versa. Valid values are from 0 to 8 inclusive.

-row-mt 1 enables row-based multi-threading which maximizes CPU usage. To enable fast decoding performance, also add tiles (i.e. -tiles 4x1 or -tiles 2x2 for 4 tiles). Enabling row-mt is only faster when the CPU has more threads than the number of encoded tiles.

-usage realtime activates the realtime mode, meant for live encoding use cases (livestreaming, videoconferencing, etc). -cpu-used values between 7-10 are only available in the realtime mode (though due to ​a bug in FFmpeg, presets higher than 8 cannot be used via FFmpeg).

Keyframe placement

By default, libaom's maximum keyframe interval is 9999 frames. This can lead to slow seeking, especially with content that has few or infrequent scene changes.

The -g option can be used to set the maximum keyframe interval. Anything up to 10 seconds is considered reasonable for most content, so for 30 frames per second content one would use -g 300, for 60 fps content -g 600, etc.

To set a fixed keyframe interval, set both -g and -keyint_min to the same value. Note that currently -keyint_min is ignored unless it's the same as -g, so the minimum keyframe interval can't be set on its own.

For intra-only output, use -g 0.

HDR and high bit depth

When encoding in HDR it's necessary to pass through color information; -colorspace, -color_trc and -color_primaries. For example, Youtube HDR uses

-colorspace bt2020nc -color_trc smpte2084 -color_primaries bt2020

AV1 includes 10-bit support in its Main profile. Thus content can be encoded in 10-bit without having to worry about incompatible hardware decoders.

To utilize 10-bit in the Main profile, use -pix_fmt yuv420p10le. For 10-bit with 4:4:4 chroma subsampling (requires the High profile), use -pix_fmt yuv444p10le. 12-bit is also supported, but requires the Professional profile. See ffmpeg -help encoder=libaom-av1 for the supported pixel formats.

Lossless encoding

Use -crf 0 for lossless encoding. Because of a bug present in FFmpeg versions prior to 4.4, the first frame will not be losslessly preserved (the issue was fixed on March 21, 2021). As a workaround on pre-4.4 versions one may use -aom-params lossless=1 for lossless output.

SVT-AV1 (libsvtav1) is an encoder originally developed by Intel in collaboration with Netflix. In 2020, SVT-AV1 was adopted by AOMedia as the basis for the future development of AV1 as well as future codec efforts. The encoder supports a wide range of speed-efficiency tradeoffs and scales fairly well across many CPU cores.

To enable support, FFmpeg needs to be built with --enable-libsvtav1. For options available in your specific build of FFmpeg, see ffmpeg -help encoder=libasvav1. See also ​FFmpeg documentation, the upstream encoder user guide and list of all parameters.

Many options are passed to the encoder with -svtav1-params. This was introduced in SVT-AV1 0.9.1 and has been supported since FFmpeg 5.1.

CRF is the default rate control method, but VBR and CBR are also available.

CRF

Much like CRF in x264 and x265, this rate control method tries to ensure that every frame gets the number of bits it deserves to achieve a certain (perceptual) quality level.

For example:

ffmpeg -i input.mp4 -c:v libsvtav1 -crf 35 svtav1_test.mp4

Note that the -crf option is only supported in FFmpeg git builds since 2022-02-24. In versions prior to this, the CRF value is set with -qp.

The valid CRF value range is 0-63, with the default being 50. Lower values correspond to higher quality and greater file size. Lossless encoding is currently not supported.

Presets and tunes

The trade-off between encoding speed and compression efficiency is managed with the -preset option. Since SVT-AV1 0.9.0, supported presets range from 0 to 13, with higher numbers providing a higher encoding speed.

Note that preset 13 is only meant for debugging and running fast convex-hull encoding. In versions prior to 0.9.0, valid presets are 0 to 8.

As an example, this command encodes a video using preset 8 and a CRF of 35 while copying the audio:

ffmpeg -i input.mp4 -c:a copy -c:v libsvtav1 -preset 8 -crf 35 svtav1_test.mp4

Since SVT-AV1 0.9.1, the encoder also supports tuning for visual quality (sharpness). This is invoked with -svtav1-params tune=0. The default value is 1, which tunes the encoder for PSNR.

Also supported since 0.9.1 is tuning the encoder to produce bitstreams that are faster (less CPU intensive) to decode, similar to the fastdecode tune in x264 and x265. Since SVT-AV1 1.0.0, this feature is invoked with -svtav1-params fast-decode=1.

In 0.9.1, the option accepts an integer from 1 to 3, with higher numbers resulting in easier-to-decode video. In 0.9.1, decoder tuning is only supported for presets from 5 to 10, and the level of decoder tuning varies between presets.

Keyframe placement

By default, SVT-AV1's keyframe interval is 2-3 seconds, which is quite short for most use cases. Consider changing this up to 5 seconds (or higher) with the -g option (or keyint in svtav1-params); -g 120 for 24 fps content, -g 150 for 30 fps, etc.

Note that as of version 1.2.1, SVT-AV1 does not support inserting keyframes at scene changes. Instead, keyframes are placed at set intervals. In SVT-AV1 0.9.1 and prior, the functionality was present but considered to be in a suboptimal state and was disabled by default.

Film grain synthesis

SVT-AV1 supports film grain synthesis, an AV1 feature for preserving the look of grainy video while spending very little bitrate to do so. The grain is removed from the image with denoising, its look is approximated and synthesized, and then added on top of the video at decode-time as a filter.

The film grain synthesis feature is invoked with -svtav1-params film-grain=X, where X is an integer from 1 to 50. Higher numbers correspond to higher levels of denoising for the grain synthesis process and thus a higher amount of grain.

librav1e is the Xiph encoder for AV1. Compile with --enable-librav1e. See ​FFmpeg doc and upstream CLI options.

Rav1e claims to be the fastest software AV1 encoder, but that really depends on the setting.

Encode/AV1     – FFmpeg (2024)

FAQs

Can FFmpeg encode AV1? ›

FFmpeg, a very popular command line tool for video processing, will now support NVIDIA NVENC AV1 encoder. It is reportedly offering better quality at lower bit rate and outperforming HEVC (H. 265) encoding by 75 to 100%.

How to encode AV1? ›

Let's check the details:
  1. Launch WinX HD Video Converter on your computer. And drag and drop or click "+Video" to load the target AV1 video file(s).
  2. Choose an output format, for example MP4 Video in H. 264 or HEVC codec. ...
  3. Click Browse to set a destination folder if necessary. Tap RUN button to start transcoding AV1 files.
Aug 15, 2022

Can HandBrake encode AV1? ›

HandBrake 1.6. 0 can encode AV1 videos on any of its supported systems. In the current release its SVT-AV1 encoder offers the widest support, encoding on your processor through software.

What supports AV1 encoding? ›

Nvidia and AMD's latest RTX 4000- and RX 7000-series GPUs also include hardware encoding support for AV1, but the software needed to use it hasn't been built into HandBrake yet.

Is AV1 better than VP9? ›

The coding performance results for this test set indicate, that AV1 is able to outperform VP9 and even HEVC by up to 40%. Please note that this evaluation primarily targets HAS services and has a very specific setup.

Is AV1 better than h265? ›

Based on earlier tests, AV1 requires 3x the encoding time of HEVC x265 and LibVPx. Also indicated in the MSU reports, AV1 encoding is about 2500-3000 times slower than competitors while X265 is about 10-15 times slower.

Can AV1 be lossless? ›

AV1 is primarily intended for lossy encoding, although lossless compression is supported as well.

Does AV1 need codec? ›

AV1 makes streaming HDR 4K video with wide color gamuts much more feasible. Though there is not really much demand for it yet, the codec is even suitable for 8K content when the time does come. It can also be used for 360-degree video with similarly high data demands.

Is AV1 higher quality? ›

AV1 is the new gold standard video format, with superior efficiency and quality compared to older H. 264 and H. 265 formats. It is the most recent royalty-free, efficient video encoder standardized by the Alliance for Open Media.

Is AV1 the best codec? ›

If you are looking for the best video quality, go for AV1. On the other hand, if you are looking for the most compatible video codec, VP9 would be the best fit for you. Finally, H. 265 codec is a great fit if you need good quality and compression without encoding overheads.

Is AV1 better than h264? ›

265 and the AV1 codec offer twice as much compression as H. 264. The supreme battle for a video encoder is to keep the bitrate low and the quality high.

Does VLC support AV1 codec? ›

Does VLC Support AV1? Yes, VLC does support AV1 codec. As a part of Alliance for Open Media, VLC AV1 codec support has been added since version 3.0. 0.

Is AV1 better than MP4? ›

The video quality is better in AVI files. AVI uses codecs that provide better video quality than the codecs used in MP4 files.

Is AV1 the future? ›

The future of AV1

Given that HEVC is only supported by one browser on desktop (now that Internet Explorer is dead, anyway), AV1 is clearly the go-to codec for the future as a VP9 successor. With support only expected to grow, more and more devices are going to end up using it.

What speed is AV1 encoder? ›

3.5 Mbps is the Sweet Spot for AV1 Live Streaming

The 3.5 Mbps results are where we see the most gains out of Intel's AV1 encoder. This encoder is so good at 3.5 Mbps that it was able to outperform both Nvidia's and AMD's encoders at 6 Mbps with nearly half the bitrate.

Does Amazon Prime Use AV1? ›

The AV1 codec is reportedly between 20 and 40 percent more efficient than the current HEVC (H. 265) codec, which replaced MPEG4 (H. 264). The HEVC format is currently being used by Netflix, Amazon, Disney+, Apple TV+, and others, to stream video in 4K HDR.

Who is AV1 competitor? ›

AV1's major competition is H. 265, aka HEVC, developed by the Moving Picture Experts Group (MPEG). Some tests show the newer AV1 codec having 30 percent higher efficiency than H. 265, but what really matters is that AV1 is royalty-free.

Does AV1 support HDR? ›

HDR10+ metadata enables devices to optimize rendering of HDR content based on the display capabilities and on a scene-by-scene and frame-by-frame basis. Various tools, services and devices support creation and use of HDR10+ metadata, which can be easily utilized directly in [AV1] systems.

Why is h265 not popular? ›

265 was hindering the adoption and as a result primary browsers have no support at all (e.g. Chrome, Firefox) or only partial support (Edge). Due to this, many content providers have stuck with h. 264 because at least they know it will always play.

How much bandwidth does AV1 4K use? ›

On the top end, Bitmovin's Per-Title AV1 delivers 4K under 2 Mbps. The bottom 240kbps rung is 1600 x 900, so even on over-shared wifi, your users would still be happily watching even better than 720p video.

Does RTX 3080 support AV1? ›

Making AV1 Accessible To Everyone

And our latest GeForce RTX 30 Series GPUs are ready to tackle up to 8K HDR streams with a new dedicated AV1 hardware decoder.

Does Apple support AV1? ›

New Apple M2 doesn't support AV1 decode.

What are the drawbacks of AV1? ›

What are the disadvantages of AV1? There are some drawbacks to the AV1 format despite its growing popularity. The AV1 chip uses hardware encoding to produce its results and there are not as many chips that support this level of video compression, so the AV1 is not as widespread in use as others.

What are the disadvantages of AV1? ›

The primary drawback to AV1 at this time is that it is very new, and support is still in the process of being integrated into most browsers. Additionally, encoders and decoders are still being optimized for performance, and hardware encoders and decoders are still mostly in development rather than production.

What are the cons of AV1? ›

It is a heavier codec that asks for high-end hardware to decode it. Consiquently, playing AV1 file will end up with errors, even if you install AV1 codec or rely on the AV1 media player. One feasible way to fix the issue is to convert AV1 to MP4 (H. 264/HEVC) that is more compatible with your device.

What is the most efficient video codec? ›

For web streaming, the best video codec is simple to identify – it is H. 264. H. 264 is hands down the best codec for web streaming because it is highly efficient and compatible with most other forms of video technology you need to use for web streaming.

How do I convert Av1 to Mp4? ›

Convert Av1 To Mp4
  1. Download and install the latest version of Filestar.
  2. Right click on one or more Av1 file(s) on your desktop and select Convert with Filestar.
  3. Type convert to mp4 in the search box.
  4. Press Convert.

What are the advantages of Av1? ›

These new chips allow your device to display higher quality video while using less bandwidth. AV1 takes advantage of recent advances in compute to deliver video with dramatically fewer bytes, even compared to other relatively recent video protocols like VP9 and HEVC.

Is AVI obsolete? ›

Having considered everything, we'd say that AVI has one good use left: preservation. It's slowly becoming more and more obsolete, not only compared to MKV, but also to many other video file types.

Does Google Chrome support AV1? ›

The AV1 decoder will be added to Chrome Desktop x86 devices (Windows, macOS, Linux, Chrome OS) based on the official bitstream specification. At this time, support is limited to “Main” profile 0 and does not include encoding capabilities. The supported container is ISO-BMFF (MP4).

Is AV1 hardware accelerated? ›

The Xe Media Engine supports acceleration for the broadest set of video codecs and standards and includes industry-first AV1 hardware-accelerated encoding and decoding. AV1 is up to 50% more efficient than today's most common codec, H. 264, and 30% more efficient than H. 265.

What is the best bitrate encoding? ›

What's the best video bitrate for 1080p broadcasts? For 1080p videos, the ideal bitrate ranges from 3,500 to 6,000 Kbps. If you're using a standard frame rate (30fps), aim for the lower end of the range, between 3,500 and 5,000 Kbps. If you have a high frame rate (60fps), aim for a bitrate of 4,500 to 6,000 Kbps.

Does Nvenc support AV1? ›

The dedicated encoder hardware NVENC can perform 8- and 10-bit AV1 encoding in addition to 8-bit H. 264, 8- and 10-bit HEVC encoding.

Can CPU decode AV1? ›

AV1 encoding and decoding can be accomplished by brute forcing it on a CPU via software, but it is more computationally intensive than even H. 265 HEVC. This puts it out of reach for lower end hardware to handle, not to mention the impact on battery life for mobile devices.

Can FFmpeg convert audio? ›

FFmpeg is a great tool for quickly changing an AV file's format or quality, extracting audio, creating GIFs, and more. There are many open source tools out there for editing, tweaking, and converting multimedia into exactly what you need.

Is AV1 better than H264? ›

265 and the AV1 codec offer twice as much compression as H. 264. The supreme battle for a video encoder is to keep the bitrate low and the quality high.

Does the RTX 3080 support AV1? ›

Making AV1 Accessible To Everyone

And our latest GeForce RTX 30 Series GPUs are ready to tackle up to 8K HDR streams with a new dedicated AV1 hardware decoder.

Does OBS have AV1 encoding? ›

OBS Studio 29 now enables AV1 encoding for AMD and Intel GPUs. AV1 video codec support expands. One of the most popular recording and streaming software has been updated to support the latest encoding capabilities of modern GPUs.

Is AV1 better quality? ›

Typically, AV1 codec is 30% better than HEVC in terms of the compression efficiency. It saves up to 30% in bandwidth for the same image quality in HEVC and 50% of VP9.

What audio codec is best for FFmpeg? ›

The highest quality internal/native encoder available in FFmpeg without any external libraries is aac. Please note it is not recommended to use the experimental vorbis for Vorbis encoding; use libvorbis instead. Please note that wmav1 and wmav2 don't seem to be able to reach transparency at any given bitrate.

Is there anything better than FFmpeg? ›

We have compiled a list of solutions that reviewers voted as the best overall alternatives and competitors to FFmpeg, including VideoLan, Handbrake, PotPlayer, and AWS Elemental MediaTailor.

Is FFmpeg legal? ›

FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later. However, FFmpeg incorporates several optional parts and optimizations that are covered by the GNU General Public License (GPL) version 2 or later. If those parts get used the GPL applies to all of FFmpeg.

Is AV1 better quality than MP4? ›

While AVI seems to be the better media container for quality, it uses very large file sizes; hence, may require compression to smaller file formats. MP4, on the other hand, uses smaller file sizes and works with almost all media players but has an inferior video output quality compared to AVI.

Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 6125

Rating: 5 / 5 (80 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.