Video Codec
video-codec
The parameter for video-codec specifies the video codec for encoding. This parameter will only work with fm=mp4 is set.
The parameter accepts the following as values:
h264(H.264) (default): The most widely supported codec across devices and browsers. A good balance between quality and compatibility.h265(H.265): Improved compression over H.264 but with less universal browser support.av1(AV1): Next-generation codec with high compression efficiency. Best for modern web use, but may have limited hardware support.
Video codecs compress and decompress digital video files. Choosing the right codec affects the quality, file size, and compatibility with different devices and browsers.
Reduce bandwidth by serving every codec from one file
Imgix transcodes your video on the fly, so you only need to store a single source file. List the same video with video-codec=av1, video-codec=h265, and video-codec=h264 in one <video> source set, and each browser plays the most efficient codec it supports. Viewers on modern browsers download smaller files at the same visual quality, while older browsers fall back to H.264.
See Creating a User-Friendly Video Player for a copy-and-paste example.
Video Codec Comparison
The demo below compares file sizes across the three codecs: AV1, H.264, and H.265. Each codec is automatically set to different bitrates that produce similar visual quality, allowing you to see the file size differences between codecs. H.264 is used as the baseline for comparison since it’s the most widely supported codec across all browsers.
Select different codecs from the dropdown menus to compare their file sizes and visual output.
Video Codec Browser Support
Browsers and devices support each video codecs in varying degrees. Because of this, it’s important to check browser support when choosing a codec for your videos.
You can learn more about best practices for detecting and serving video codecs in our Creating a User-Friendly Video Player tutorial.
You can also see your own device and browser’s support for each codec by seeing the demo below: