Skip to content

πŸŽ₯ Make videos programmatically with React

`@remotion/renderer`: add AV1 codec support (#6771)

Igor Samokhovets59cf93073969
diff --git a/packages/cli/src/image-formats.ts b/packages/cli/src/image-formats.ts
index f5f7f1fd2f..3da68e6469 100644
--- a/packages/cli/src/image-formats.ts
+++ b/packages/cli/src/image-formats.ts
@@ -32,6 +32,7 @@ export const getVideoImageFormat = ({
codec === 'h264-mkv' ||
codec === 'h264-ts' ||
codec === 'h265' ||
+ codec === 'av1' ||
codec === 'vp8' ||
codec === 'vp9' ||
codec === 'prores' ||
diff --git a/packages/cli/src/test/codec.test.ts b/packages/cli/src/test/codec.test.ts
index 0e9c239207..281dc54f8b 100644
--- a/packages/cli/src/test/codec.test.ts
+++ b/packages/cli/src/test/codec.test.ts
@@ -11,6 +11,7 @@ describe('Codec tests setCodec', () => {
'h265',
'vp8',
'vp9',
+ 'av1',
undefined,
];
validCodecInputs.forEach((entry) =>
diff --git a/packages/cli/src/test/final-output-codec.test.ts b/packages/cli/src/test/final-output-codec.test.ts
index 080127b8ab..def7264b0f 100644
--- a/packages/cli/src/test/final-output-codec.test.ts
+++ b/packages/cli/src/test/final-output-codec.test.ts
@@ -10,6 +10,7 @@ describe('Codec tests valid codec input', () => {
'h265',
'vp8',
'vp9',
+ 'av1',
'mp3',
'aac',
'wav',
diff --git a/packages/cli/src/test/image-formats.test.ts b/packages/cli/src/test/image-formats.test.ts
new file mode 100644
index 0000000000..cd40698854
--- /dev/null
+++ b/packages/cli/src/test/image-formats.test.ts
@@ -0,0 +1,12 @@
+import {expect, test} from 'bun:test';
+import {getVideoImageFormat} from '../image-formats';
+
+test('returns jpeg for av1 codec', () => {
+ expect(getVideoImageFormat({codec: 'av1', uiImageFormat: null})).toBe('jpeg');
+});
+
+test('returns png if codec is undefined', () => {
+ expect(getVideoImageFormat({codec: undefined, uiImageFormat: null})).toBe(
+ 'png',
+ );
+});
diff --git a/packages/compositor-darwin-arm64/ffmpeg b/packages/compositor-darwin-arm64/ffmpeg
index 95e3838505..2e2bae0702 100755
Binary files a/packages/compositor-darwin-arm64/ffmpeg and b/packages/compositor-darwin-arm64/ffmpeg differ
diff --git a/packages/compositor-darwin-arm64/ffprobe b/packages/compositor-darwin-arm64/ffprobe
index f313598f0e..bff9b2dd96 100755
Binary files a/packages/compositor-darwin-arm64/ffprobe and b/packages/compositor-darwin-arm64/ffprobe differ
diff --git a/packages/compositor-darwin-arm64/libavcodec.dylib b/packages/compositor-darwin-arm64/libavcodec.dylib
index 9234ac8bc1..847a686c1f 100755
Binary files a/packages/compositor-darwin-arm64/libavcodec.dylib and b/packages/compositor-darwin-arm64/libavcodec.dylib differ
diff --git a/packages/compositor-darwin-arm64/libavdevice.dylib b/packages/compositor-darwin-arm64/libavdevice.dylib
index 1cfd1154f7..83b6775a10 100755
Binary files a/packages/compositor-darwin-arm64/libavdevice.dylib and b/packages/compositor-darwin-arm64/libavdevice.dylib differ
diff --git a/packages/compositor-darwin-arm64/libavfilter.dylib b/packages/compositor-darwin-arm64/libavfilter.dylib
index 052d1760a2..522ffe08de 100755
Binary files a/packages/compositor-darwin-arm64/libavfilter.dylib and b/packages/compositor-darwin-arm64/libavfilter.dylib differ
diff --git a/packages/compositor-darwin-arm64/libavformat.dylib b/packages/compositor-darwin-arm64/libavformat.dylib
index 63b301cffa..46b6b343c4 100755
Binary files a/packages/compositor-darwin-arm64/libavformat.dylib and b/packages/compositor-darwin-arm64/libavformat.dylib differ
diff --git a/packages/compositor-darwin-arm64/libavutil.dylib b/packages/compositor-darwin-arm64/libavutil.dylib
index 55b76863ed..761c42359e 100755
Binary files a/packages/compositor-darwin-arm64/libavutil.dylib and b/packages/compositor-darwin-arm64/libavutil.dylib differ
diff --git a/packages/compositor-darwin-arm64/libswresample.dylib b/packages/compositor-darwin-arm64/libswresample.dylib
index 2fbbc8f8a2..a22795de44 100755
Binary files a/packages/compositor-darwin-arm64/libswresample.dylib and b/packages/compositor-darwin-arm64/libswresample.dylib differ
diff --git a/packages/compositor-darwin-arm64/libswscale.dylib b/packages/compositor-darwin-arm64/libswscale.dylib
index b797dfb6f5..0f59428d04 100755
Binary files a/packages/compositor-darwin-arm64/libswscale.dylib and b/packages/compositor-darwin-arm64/libswscale.dylib differ
diff --git a/packages/compositor-darwin-arm64/remotion b/packages/compositor-darwin-arm64/remotion
index d516b10d14..2568352cc8 100755
Binary files a/packages/compositor-darwin-arm64/remotion and b/packages/compositor-darwin-arm64/remotion differ
diff --git a/packages/compositor-darwin-x64/ffmpeg b/packages/compositor-darwin-x64/ffmpeg
index eb31ad083a..55621a083b 100755
Binary files a/packages/compositor-darwin-x64/ffmpeg and b/packages/compositor-darwin-x64/ffmpeg differ
diff --git a/packages/compositor-darwin-x64/ffprobe b/packages/compositor-darwin-x64/ffprobe
index 6537310af0..7e169bf4d4 100755
Binary files a/packages/compositor-darwin-x64/ffprobe and b/packages/compositor-darwin-x64/ffprobe differ
diff --git a/packages/compositor-darwin-x64/libavcodec.dylib b/packages/compositor-darwin-x64/libavcodec.dylib
index 797efbb43d..07e837bc11 100755
Binary files a/packages/compositor-darwin-x64/libavcodec.dylib and b/packages/compositor-darwin-x64/libavcodec.dylib differ
diff --git a/packages/compositor-darwin-x64/libavdevice.dylib b/packages/compositor-darwin-x64/libavdevice.dylib
index 3f842ee589..d5987ab194 100755
Binary files a/packages/compositor-darwin-x64/libavdevice.dylib and b/packages/compositor-darwin-x64/libavdevice.dylib differ
diff --git a/packages/compositor-darwin-x64/libavfilter.dylib b/packages/compositor-darwin-x64/libavfilter.dylib
index 13bdf67527..05e9c914dd 100755
Binary files a/packages/compositor-darwin-x64/libavfilter.dylib and b/packages/compositor-darwin-x64/libavfilter.dylib differ
diff --git a/packages/compositor-darwin-x64/libavformat.dylib b/packages/compositor-darwin-x64/libavformat.dylib
index e16950248e..feafc1fed0 100755
Binary files a/packages/compositor-darwin-x64/libavformat.dylib and b/packages/compositor-darwin-x64/libavformat.dylib differ
diff --git a/packages/compositor-darwin-x64/libavutil.dylib b/packages/compositor-darwin-x64/libavutil.dylib
index 821346fa89..060347ae34 100755
Binary files a/packages/compositor-darwin-x64/libavutil.dylib and b/packages/compositor-darwin-x64/libavutil.dylib differ
diff --git a/packages/compositor-darwin-x64/libswresample.dylib b/packages/compositor-darwin-x64/libswresample.dylib
index be654026f8..ba8799faa7 100755
Binary files a/packages/compositor-darwin-x64/libswresample.dylib and b/packages/compositor-darwin-x64/libswresample.dylib differ
diff --git a/packages/compositor-darwin-x64/libswscale.dylib b/packages/compositor-darwin-x64/libswscale.dylib
index d547f77985..1d2fbce0b9 100755
Binary files a/packages/compositor-darwin-x64/libswscale.dylib and b/packages/compositor-darwin-x64/libswscale.dylib differ
diff --git a/packages/compositor-darwin-x64/remotion b/packages/compositor-darwin-x64/remotion
index bc82e079b7..e2ee5fe982 100755
Binary files a/packages/compositor-darwin-x64/remotion and b/packages/compositor-darwin-x64/remotion differ
diff --git a/packages/compositor-linux-arm64-gnu/ffmpeg b/packages/compositor-linux-arm64-gnu/ffmpeg
index 46857ed4cb..6acf8d228d 100755
Binary files a/packages/compositor-linux-arm64-gnu/ffmpeg and b/packages/compositor-linux-arm64-gnu/ffmpeg differ
diff --git a/packages/compositor-linux-arm64-gnu/ffprobe b/packages/compositor-linux-arm64-gnu/ffprobe
index 5ab2fd4872..a0f209b600 100755
Binary files a/packages/compositor-linux-arm64-gnu/ffprobe and b/packages/compositor-linux-arm64-gnu/ffprobe differ
diff --git a/packages/compositor-linux-arm64-gnu/libavcodec.so b/packages/compositor-linux-arm64-gnu/libavcodec.so
index c431fcd0ed..dfc374c0a1 100755
Binary files a/packages/compositor-linux-arm64-gnu/libavcodec.so and b/packages/compositor-linux-arm64-gnu/libavcodec.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libavdevice.so b/packages/compositor-linux-arm64-gnu/libavdevice.so
index ca6fc50efc..905cdb99ed 100755
Binary files a/packages/compositor-linux-arm64-gnu/libavdevice.so and b/packages/compositor-linux-arm64-gnu/libavdevice.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libavfilter.so b/packages/compositor-linux-arm64-gnu/libavfilter.so
index 45ffe8714a..84f057b900 100755
Binary files a/packages/compositor-linux-arm64-gnu/libavfilter.so and b/packages/compositor-linux-arm64-gnu/libavfilter.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libavformat.so b/packages/compositor-linux-arm64-gnu/libavformat.so
index c21bd7fbd7..b45cf03784 100755
Binary files a/packages/compositor-linux-arm64-gnu/libavformat.so and b/packages/compositor-linux-arm64-gnu/libavformat.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libavutil.so b/packages/compositor-linux-arm64-gnu/libavutil.so
index f3908aabfd..e6769e52a2 100755
Binary files a/packages/compositor-linux-arm64-gnu/libavutil.so and b/packages/compositor-linux-arm64-gnu/libavutil.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libswresample.so b/packages/compositor-linux-arm64-gnu/libswresample.so
index 00ec479597..ba571ff1e5 100755
Binary files a/packages/compositor-linux-arm64-gnu/libswresample.so and b/packages/compositor-linux-arm64-gnu/libswresample.so differ
diff --git a/packages/compositor-linux-arm64-gnu/libswscale.so b/packages/compositor-linux-arm64-gnu/libswscale.so
index e184dae458..25110f68b5 100755
Binary files a/packages/compositor-linux-arm64-gnu/libswscale.so and b/packages/compositor-linux-arm64-gnu/libswscale.so differ
diff --git a/packages/compositor-linux-arm64-gnu/remotion b/packages/compositor-linux-arm64-gnu/remotion
index ef92a1824a..bb3a35bf32 100755
Binary files a/packages/compositor-linux-arm64-gnu/remotion and b/packages/compositor-linux-arm64-gnu/remotion differ
diff --git a/packages/compositor-linux-arm64-musl/ffmpeg b/packages/compositor-linux-arm64-musl/ffmpeg
index d04d8b9fcc..12a466a2f9 100755
Binary files a/packages/compositor-linux-arm64-musl/ffmpeg and b/packages/compositor-linux-arm64-musl/ffmpeg differ
diff --git a/packages/compositor-linux-arm64-musl/ffprobe b/packages/compositor-linux-arm64-musl/ffprobe
index 4db5b77808..17bd447d82 100755
Binary files a/packages/compositor-linux-arm64-musl/ffprobe and b/packages/compositor-linux-arm64-musl/ffprobe differ
diff --git a/packages/compositor-linux-arm64-musl/libavcodec.so b/packages/compositor-linux-arm64-musl/libavcodec.so
index e2f81da340..a5c629e3c5 100755
Binary files a/packages/compositor-linux-arm64-musl/libavcodec.so and b/packages/compositor-linux-arm64-musl/libavcodec.so differ
diff --git a/packages/compositor-linux-arm64-musl/libavdevice.so b/packages/compositor-linux-arm64-musl/libavdevice.so
index 6c02563f0f..ea327c25de 100755
Binary files a/packages/compositor-linux-arm64-musl/libavdevice.so and b/packages/compositor-linux-arm64-musl/libavdevice.so differ
diff --git a/packages/compositor-linux-arm64-musl/libavfilter.so b/packages/compositor-linux-arm64-musl/libavfilter.so
index 5b2e1ef4a0..f5e812e9d7 100755
Binary files a/packages/compositor-linux-arm64-musl/libavfilter.so and b/packages/compositor-linux-arm64-musl/libavfilter.so differ
diff --git a/packages/compositor-linux-arm64-musl/libavformat.so b/packages/compositor-linux-arm64-musl/libavformat.so
index a9b86c855f..135b02a78e 100755
Binary files a/packages/compositor-linux-arm64-musl/libavformat.so and b/packages/compositor-linux-arm64-musl/libavformat.so differ
diff --git a/packages/compositor-linux-arm64-musl/libavutil.so b/packages/compositor-linux-arm64-musl/libavutil.so
index 8208db86c5..ec54eed90d 100755
Binary files a/packages/compositor-linux-arm64-musl/libavutil.so and b/packages/compositor-linux-arm64-musl/libavutil.so differ
diff --git a/packages/compositor-linux-arm64-musl/libswresample.so b/packages/compositor-linux-arm64-musl/libswresample.so
index 404e047c3d..47a005f893 100755
Binary files a/packages/compositor-linux-arm64-musl/libswresample.so and b/packages/compositor-linux-arm64-musl/libswresample.so differ
diff --git a/packages/compositor-linux-arm64-musl/libswscale.so b/packages/compositor-linux-arm64-musl/libswscale.so
index 0847f0ddbc..65a86298a1 100755
Binary files a/packages/compositor-linux-arm64-musl/libswscale.so and b/packages/compositor-linux-arm64-musl/libswscale.so differ
diff --git a/packages/compositor-linux-arm64-musl/remotion b/packages/compositor-linux-arm64-musl/remotion
index 5aaa910905..f66bc824d7 100755
Binary files a/packages/compositor-linux-arm64-musl/remotion and b/packages/compositor-linux-arm64-musl/remotion differ
diff --git a/packages/compositor-linux-x64-gnu/ffmpeg b/packages/compositor-linux-x64-gnu/ffmpeg
index 7559c6122f..530eb2dab3 100755
Binary files a/packages/compositor-linux-x64-gnu/ffmpeg and b/packages/compositor-linux-x64-gnu/ffmpeg differ
diff --git a/packages/compositor-linux-x64-gnu/ffprobe b/packages/compositor-linux-x64-gnu/ffprobe
index 781706a01d..3608a90999 100755
Binary files a/packages/compositor-linux-x64-gnu/ffprobe and b/packages/compositor-linux-x64-gnu/ffprobe differ
diff --git a/packages/compositor-linux-x64-gnu/libavcodec.so b/packages/compositor-linux-x64-gnu/libavcodec.so
index 81798f1fc3..bae16392aa 100755
Binary files a/packages/compositor-linux-x64-gnu/libavcodec.so and b/packages/compositor-linux-x64-gnu/libavcodec.so differ
diff --git a/packages/compositor-linux-x64-gnu/libavdevice.so b/packages/compositor-linux-x64-gnu/libavdevice.so
index e6c797ed61..70a1874ce9 100755
Binary files a/packages/compositor-linux-x64-gnu/libavdevice.so and b/packages/compositor-linux-x64-gnu/libavdevice.so differ
diff --git a/packages/compositor-linux-x64-gnu/libavfilter.so b/packages/compositor-linux-x64-gnu/libavfilter.so
index 597532eb5a..129681c709 100755
Binary files a/packages/compositor-linux-x64-gnu/libavfilter.so and b/packages/compositor-linux-x64-gnu/libavfilter.so differ
diff --git a/packages/compositor-linux-x64-gnu/libavformat.so b/packages/compositor-linux-x64-gnu/libavformat.so
index fc4822fd47..c2727e5e64 100755
Binary files a/packages/compositor-linux-x64-gnu/libavformat.so and b/packages/compositor-linux-x64-gnu/libavformat.so differ
diff --git a/packages/compositor-linux-x64-gnu/libavutil.so b/packages/compositor-linux-x64-gnu/libavutil.so
index 5e9df1fbab..733fad96c3 100755
Binary files a/packages/compositor-linux-x64-gnu/libavutil.so and b/packages/compositor-linux-x64-gnu/libavutil.so differ
diff --git a/packages/compositor-linux-x64-gnu/libswresample.so b/packages/compositor-linux-x64-gnu/libswresample.so
index 9a3a21dd5d..2fd472796f 100755
Binary files a/packages/compositor-linux-x64-gnu/libswresample.so and b/packages/compositor-linux-x64-gnu/libswresample.so differ
diff --git a/packages/compositor-linux-x64-gnu/libswscale.so b/packages/compositor-linux-x64-gnu/libswscale.so
index eeadea86d2..2bf83a9aec 100755
Binary files a/packages/compositor-linux-x64-gnu/libswscale.so and b/packages/compositor-linux-x64-gnu/libswscale.so differ
diff --git a/packages/compositor-linux-x64-gnu/remotion b/packages/compositor-linux-x64-gnu/remotion
index 56b7fa9602..5e1e2fec0c 100755
Binary files a/packages/compositor-linux-x64-gnu/remotion and b/packages/compositor-linux-x64-gnu/remotion differ
diff --git a/packages/compositor-linux-x64-musl/ffmpeg b/packages/compositor-linux-x64-musl/ffmpeg
index 9b3ff72112..b590645b26 100755
Binary files a/packages/compositor-linux-x64-musl/ffmpeg and b/packages/compositor-linux-x64-musl/ffmpeg differ
diff --git a/packages/compositor-linux-x64-musl/ffprobe b/packages/compositor-linux-x64-musl/ffprobe
index 2172808a03..2e0e385fe4 100755
Binary files a/packages/compositor-linux-x64-musl/ffprobe and b/packages/compositor-linux-x64-musl/ffprobe differ
diff --git a/packages/compositor-linux-x64-musl/libavcodec.so b/packages/compositor-linux-x64-musl/libavcodec.so
index ee6011c010..6d2d90eff4 100755
Binary files a/packages/compositor-linux-x64-musl/libavcodec.so and b/packages/compositor-linux-x64-musl/libavcodec.so differ
diff --git a/packages/compositor-linux-x64-musl/libavdevice.so b/packages/compositor-linux-x64-musl/libavdevice.so
index 61a7b8ee2d..f05d5b8cda 100755
Binary files a/packages/compositor-linux-x64-musl/libavdevice.so and b/packages/compositor-linux-x64-musl/libavdevice.so differ
diff --git a/packages/compositor-linux-x64-musl/libavfilter.so b/packages/compositor-linux-x64-musl/libavfilter.so
index 4fb73876f6..a3158b05d9 100755
Binary files a/packages/compositor-linux-x64-musl/libavfilter.so and b/packages/compositor-linux-x64-musl/libavfilter.so differ
diff --git a/packages/compositor-linux-x64-musl/libavformat.so b/packages/compositor-linux-x64-musl/libavformat.so
index b3d55e566f..4084523f7b 100755
Binary files a/packages/compositor-linux-x64-musl/libavformat.so and b/packages/compositor-linux-x64-musl/libavformat.so differ
diff --git a/packages/compositor-linux-x64-musl/libavutil.so b/packages/compositor-linux-x64-musl/libavutil.so
index 8536a3737e..a7245b6426 100755
Binary files a/packages/compositor-linux-x64-musl/libavutil.so and b/packages/compositor-linux-x64-musl/libavutil.so differ
diff --git a/packages/compositor-linux-x64-musl/libswresample.so b/packages/compositor-linux-x64-musl/libswresample.so
index 1237ae08a0..59678e114a 100755
Binary files a/packages/compositor-linux-x64-musl/libswresample.so and b/packages/compositor-linux-x64-musl/libswresample.so differ
diff --git a/packages/compositor-linux-x64-musl/libswscale.so b/packages/compositor-linux-x64-musl/libswscale.so
index 59c51baca9..31d56475a0 100755
Binary files a/packages/compositor-linux-x64-musl/libswscale.so and b/packages/compositor-linux-x64-musl/libswscale.so differ
diff --git a/packages/compositor-linux-x64-musl/remotion b/packages/compositor-linux-x64-musl/remotion
index 36849f1d28..f05d88b511 100755
Binary files a/packages/compositor-linux-x64-musl/remotion and b/packages/compositor-linux-x64-musl/remotion differ
diff --git a/packages/compositor/Cargo.lock b/packages/compositor/Cargo.lock
index 034edb65e0..7a456dd62e 100644
--- a/packages/compositor/Cargo.lock
+++ b/packages/compositor/Cargo.lock
@@ -157,7 +157,7 @@ dependencies = [
[[package]]
name = "ffmpeg-next"
version = "7.1.0"
-source = "git+https://github.com/remotion-dev/rust-ffmpeg?rev=64ff1506e2fd4b9b7fa501102d4cf3ee7c47bd81#64ff1506e2fd4b9b7fa501102d4cf3ee7c47bd81"
+source = "git+https://github.com/remotion-dev/rust-ffmpeg?rev=873696322d49c429bee3ba018e8e0512a53f8ff3#873696322d49c429bee3ba018e8e0512a53f8ff3"
dependencies = [
"bitflags 2.6.0",
"ffmpeg-sys-next",
@@ -167,7 +167,7 @@ dependencies = [
[[package]]
name = "ffmpeg-sys-next"
version = "7.1.0"
-source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=872d1537be329a1d40fd9fd32a5d265e291ef094#872d1537be329a1d40fd9fd32a5d265e291ef094"
+source = "git+https://github.com/remotion-dev/rust-ffmpeg-sys?rev=73b853fd67aaa48c929db647c5e8045dca9b491a#73b853fd67aaa48c929db647c5e8045dca9b491a"
dependencies = [
"bindgen",
"cc",
diff --git a/packages/compositor/Cargo.toml b/packages/compositor/Cargo.toml
index b6d7718ed2..4c6dcbc2ec 100644
--- a/packages/compositor/Cargo.toml
+++ b/packages/compositor/Cargo.toml
@@ -15,7 +15,7 @@ lazy_static = "1.4"
rayon-core = "1.12.1"
sysinfo = "0.30.7"
mp4 = { git = "https://github.com/jonnyburger/mp4-rust", rev = "92ba375738cc2f05a4d754e1f968cf2e97d06641" }
-ffmpeg-next = { git = "https://github.com/remotion-dev/rust-ffmpeg", rev = "64ff1506e2fd4b9b7fa501102d4cf3ee7c47bd81" }
+ffmpeg-next = { git = "https://github.com/remotion-dev/rust-ffmpeg", rev = "873696322d49c429bee3ba018e8e0512a53f8ff3" }
[[bin]]
name = "remotion"
diff --git a/packages/core/src/codec.ts b/packages/core/src/codec.ts
index c5339ad603..20f9eaf177 100644
--- a/packages/core/src/codec.ts
+++ b/packages/core/src/codec.ts
@@ -3,6 +3,7 @@ export const validCodecs = [
'h265',
'vp8',
'vp9',
+ 'av1',
'mp3',
'aac',
'wav',
diff --git a/packages/docs/docs/cli/render.mdx b/packages/docs/docs/cli/render.mdx
index b40646d55c..e643705411 100644
--- a/packages/docs/docs/cli/render.mdx
+++ b/packages/docs/docs/cli/render.mdx
@@ -90,7 +90,9 @@ Sets the output file path, as an alternative to the `output-location` positional
### `--codec`<AvailableFrom v="1.4.0" />
-[`h264` or `h265` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav` or `prores` or `h264-mkv`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder.
+[`h264` or `h265` or `av1` or `png` or `vp8` or `vp9` or `mp3` or `aac` or `wav` or `prores` or `h264-mkv`](/docs/config#setcodec). If you don't supply `--codec`, it will use the H.264 encoder.
+
+If you are rendering on Linux ARM64 GNU, `av1` is not available.
### `--audio-codec`<AvailableFrom v="3.3.42" />
diff --git a/packages/docs/docs/compare.mdx b/packages/docs/docs/compare.mdx
index a1008a080a..a2fd5f7e27 100644
--- a/packages/docs/docs/compare.mdx
+++ b/packages/docs/docs/compare.mdx
@@ -82,6 +82,8 @@ Remotion Lambda currently has the following features that Cloud Run does not hav
Rendering with Vercel Sandbox or the Node.JS APIs does not come with these features either, but you may build them based on top of the low-level APIs that are provided.
+`AV1` output is not available on Remotion Lambda or Linux ARM64 GNU because those runtimes ship only the essential codecs to stay lean.
+
## GPU
Most renders do not become faster with GPU acceleration. See: [Which content benefits from a GPU?](/docs/gpu).
diff --git a/packages/docs/docs/config.mdx b/packages/docs/docs/config.mdx
index f0fd287159..2038afe07b 100644
--- a/packages/docs/docs/config.mdx
+++ b/packages/docs/docs/config.mdx
@@ -589,17 +589,20 @@ The [command line flag](/docs/cli/render#--pixel-format) `--pixel-format` will t
## `setCodec()`<AvailableFrom v="1.4.0" />
-Choose one of the supported codecs: `h264` _(default)_, `h265`, `vp8`, `vp9`.
+Choose one of the supported codecs: `h264` _(default)_, `h265`, `vp8`, `vp9`, `av1`.
- `h264` is the classic MP4 file as you know it.
- `h265` is the successor of H264, with smaller file sizes. Also known as HEVC. Poor browser compatibility.
- `vp8` is the codec for WebM.
- `vp9` is the next-generation codec for WebM. Lower file size, longer compression time.
+- `av1` is the successor of VP9 and achieves lower file size, with longer compression time.
- `prores` is a common codec if you want to import the output into another video editing program _(available from v2.1.6)_
- `mp3` will export audio only as an MP3 file _(available from v2.0)_
- `wav` will export audio only as an WAV file _(available from v2.0)_
- `aac` will export audio only as an AAC file _(available from v2.0)_
+`AV1` is not available on Remotion Lambda or Linux ARM64 GNU. See the [Encoding guide](/docs/encoding) for details.
+
```ts twoslash title="remotion.config.ts"
import {Config} from '@remotion/cli/config';
// ---cut---
@@ -727,6 +730,7 @@ Ranges for CRF scale, by codec:
- `h265` crf range is 0-51 where crf 23 is _default_.
- `vp8` crf range is 4-63 where crf 9 is _default_.
- `vp9` crf range is 0-63 where crf 28 is _default_.
+- `av1` crf range is 0-63 where crf 30 is _default_.
The lowest value is lossless, and the highest value is the worst quality possible. Higher values decrease the filesize at the cost of quality.
diff --git a/packages/docs/docs/encoding.mdx b/packages/docs/docs/encoding.mdx
index e16b556e4c..d0bed6ccb8 100644
--- a/packages/docs/docs/encoding.mdx
+++ b/packages/docs/docs/encoding.mdx
@@ -9,7 +9,7 @@ Backed by [FFmpeg](https://ffmpeg.org/), Remotion allows you to configure a vari
## Choosing a codec
-Remotion supports 5 video codecs: `h264` (_default_), `h265`, `vp8`, `vp9` and `prores`. While H264 will work well in most cases, sometimes it's worth going for a different codec. Refer to the table below to see the advantages and drawbacks of each codec.
+Remotion supports 6 video codecs: `h264` (_default_), `h265`, `vp8`, `vp9`, `av1` and `prores`. While H264 will work well in most cases, sometimes it's worth going for a different codec. Refer to the table below to see the advantages and drawbacks of each codec.
<table>
<tr>
@@ -78,6 +78,18 @@ Remotion supports 5 video codecs: `h264` (_default_), `h265`, `vp8`, `vp9` and `
</td>
<td>No</td>
</tr>
+ <tr>
+ <td>AV1*</td>
+ <td>.mp4, .webm or .mkv</td>
+ <td style={{color: 'green', fontWeight: 'bold'}}>Very small</td>
+ <td style={{color: 'red', fontWeight: 'bold'}}>Very slow</td>
+ <td>
+ <a href="https://caniuse.com/av1" style={{color: 'darkorange'}}>
+ Okay
+ </a>
+ </td>
+ <td>No</td>
+ </tr>
<tr>
<td>ProRes</td>
<td>.mov</td>
@@ -92,13 +104,17 @@ Remotion supports 5 video codecs: `h264` (_default_), `h265`, `vp8`, `vp9` and `
Click on a browser compatibility link to see exactly which browsers are supported on caniuse.com.
:::
+* AV1 is not available on [Remotion Lambda](/docs/lambda) or Linux ARM64 GNU.
+
+AV1 can achieve very small file sizes, but encoding is significantly slower than H.264 and H.265. Some runtimes ship only the essential codecs to stay lean, so `AV1` output is not available on Remotion Lambda or Linux ARM64 GNU.
+
You can set a config using [`Config.setCodec()` in the config file](/docs/config#setcodec) or the [`--codec`](/docs/cli) CLI flag.
[Hardware acceleration](/docs/hardware-acceleration) is available from Remotion 4.0.228.
## Controlling quality using the CRF setting
-_Applies only to `h264`, `h265`, `vp8` and `vp9`._
+_Applies only to `h264`, `h265`, `vp8`, `vp9` and `av1`._
No matter which codec you end up using, there's always a tradeoff between file size and video quality. You can control it by setting the so called CRF (Constant Rate Factor). The **lower the number, the better the quality**, the higher the number, the smaller the file is – of course at the cost of quality.
@@ -135,6 +151,12 @@ Be cautious: Every codec has it's own range of acceptable values and a different
<td>63</td>
<td>28</td>
</tr>
+ <tr>
+ <td>AV1</td>
+ <td>0</td>
+ <td>63</td>
+ <td>30</td>
+ </tr>
</table>
You can [set a CRF in the config file using the `Config.setCrf()`](/docs/config#setcrf) function or use the [`--crf`](/docs/cli/render#--jpeg-quality) command line flag.
diff --git a/packages/docs/docs/lambda.mdx b/packages/docs/docs/lambda.mdx
index b1fd906132..a863feaccb 100644
--- a/packages/docs/docs/lambda.mdx
+++ b/packages/docs/docs/lambda.mdx
@@ -60,6 +60,7 @@ The following regions are available for Remotion Lambda:
- You only have up to 10GB of storage available in a Lambda function. This must be sufficient for both the separated chunks and the concatenated output, therefore the output file can only be about 5GB maximum, limiting the maximum video length to around 2 hours of Full HD video.
- [Lambda has a global limit of 1000 concurrent lambdas per region by default, although it can be increased](/docs/lambda/troubleshooting/rate-limit).
+- AV1 encoding is not available on Lambda.
## Cost
diff --git a/packages/docs/docs/lambda/cli/render.mdx b/packages/docs/docs/lambda/cli/render.mdx
index 4c60854f16..40aca4e036 100644
--- a/packages/docs/docs/lambda/cli/render.mdx
+++ b/packages/docs/docs/lambda/cli/render.mdx
@@ -143,7 +143,9 @@ Renamed to `jpegQuality` in `v4.0.0`.
### `--codec`
-[`h264` or `h265` (supported since v4.0.32) or `png` or `vp8` or `mp3` or `aac` or `wav` or `prores`](/docs/config#setcodec). If you don't supply `--codec`, it will use `h264`.
+[`h264` or `h265` or `vp8` or `vp9` or `gif` or `mp3` or `aac` or `wav` or `prores`](/docs/config#setcodec). If you don't supply `--codec`, it will use `h264`.
+
+`av1` is not available on Lambda due to function size constraints.
### `--audio-codec`<AvailableFrom v="3.3.42" />
diff --git a/packages/docs/docs/lambda/rendermediaonlambda.mdx b/packages/docs/docs/lambda/rendermediaonlambda.mdx
index 4bf1d0d934..1dccc2e607 100644
--- a/packages/docs/docs/lambda/rendermediaonlambda.mdx
+++ b/packages/docs/docs/lambda/rendermediaonlambda.mdx
@@ -107,10 +107,12 @@ You may transform input props using [`calculateMetadata()`](/docs/calculate-meta
Which codec should be used to encode the video.
-Video codecs `h264`, and `vp8` are supported, `prores` is supported since `v3.2.0`. `h265` support has been added in `v4.0.32`.
+Video codecs `h264`, `h265`, `vp8`, `vp9`, `gif` and `prores` are supported.
Audio codecs `mp3`, `aac` and `wav` are also supported.
+`av1` is not available on Lambda due to function size constraints.
+
The option `h264-mkv` has been renamed to just `h264` since `v3.3.34`. Use `h264` to get the same behavior.
See also [`renderMedia() -> codec`](/docs/renderer/render-media#codec).
diff --git a/packages/docs/docs/lambda/runtime.mdx b/packages/docs/docs/lambda/runtime.mdx
index be9141cdea..463a6c1629 100644
--- a/packages/docs/docs/lambda/runtime.mdx
+++ b/packages/docs/docs/lambda/runtime.mdx
@@ -75,6 +75,8 @@ The browser was compiled including the proprietary codecs, so you can include MP
The FFmpeg which is built into `@remotion/renderer` is being used on Lambda.
+The Lambda runtime ships with the essential codecs to keep it lean, so it does not include the AV1 encoder. The same lean binary set is also used on Linux ARM64 GNU. AV1 decode support remains available, and AV1 encoding remains available on the other shipped targets.
+
## Fonts
The function includes the following fonts:
diff --git a/packages/docs/docs/miscellaneous/video-formats.mdx b/packages/docs/docs/miscellaneous/video-formats.mdx
index 36727a47a2..fbdf66eb68 100644
--- a/packages/docs/docs/miscellaneous/video-formats.mdx
+++ b/packages/docs/docs/miscellaneous/video-formats.mdx
@@ -7,7 +7,7 @@ sidebar_label: Video formats
Remotion supports a variety of video codecs.
-**Output formats**: Videos can be rendered to `H.264` (MP4), `H.265`, (HEVC), `VP8` and `VP9` (WebM), `ProRes` as well as GIFs. See the [Encoding guide](/docs/encoding) for more detail.
+**Output formats**: Videos can be rendered to `H.264` (MP4), `H.265` (HEVC), `VP8` and `VP9` (WebM), `AV1`, `ProRes` as well as GIFs. `AV1` is not available on Remotion Lambda or Linux ARM64 GNU because those runtimes ship only the essential codecs to stay lean. See the [Encoding guide](/docs/encoding) for more detail.
**Codecs supported for [`<Video>`](/docs/media/video):** Remotion uses WebCodecs and [Mediabunny](/docs/mediabunny) for playback. See the [Supported formats and codecs for `@remotion/media`](/docs/media/support) page for more details.
diff --git a/packages/docs/docs/renderer/combine-chunks.mdx b/packages/docs/docs/renderer/combine-chunks.mdx
index d2038c2a1b..3bb2753bd5 100644
--- a/packages/docs/docs/renderer/combine-chunks.mdx
+++ b/packages/docs/docs/renderer/combine-chunks.mdx
@@ -63,7 +63,7 @@ An array of absolute file paths pointing to the audio chunks to be combined. The
### `codec`
-_"h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif"_
+_"h264" | "h265" | "av1" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif"_
The codec to use for the output file. See the distributed rendering guide to see which parameter to set.
diff --git a/packages/renderer/src/codec-supports-media.ts b/packages/renderer/src/codec-supports-media.ts
index 5cd6f05954..d4a897be7c 100644
--- a/packages/renderer/src/codec-supports-media.ts
+++ b/packages/renderer/src/codec-supports-media.ts
@@ -31,6 +31,10 @@ const support: {[key in Codec]: MediaSupport} = {
video: true,
audio: true,
},
+ av1: {
+ video: true,
+ audio: true,
+ },
mp3: {
audio: true,
video: false,
@@ -64,6 +68,7 @@ const codecSupportsVideoBitrateMap: {[key in Codec]: boolean} = {
gif: false,
h264: true,
h265: true,
+ av1: true,
mp3: false,
prores: false,
vp8: true,
diff --git a/packages/renderer/src/codec.ts b/packages/renderer/src/codec.ts
index c5339ad603..20f9eaf177 100644
--- a/packages/renderer/src/codec.ts
+++ b/packages/renderer/src/codec.ts
@@ -3,6 +3,7 @@ export const validCodecs = [
'h265',
'vp8',
'vp9',
+ 'av1',
'mp3',
'aac',
'wav',
diff --git a/packages/renderer/src/combine-chunks.ts b/packages/renderer/src/combine-chunks.ts
index 3b48496cc3..1771e6c755 100644
--- a/packages/renderer/src/combine-chunks.ts
+++ b/packages/renderer/src/combine-chunks.ts
@@ -70,6 +70,7 @@ const codecSupportsFastStart: {[key in Codec]: boolean} = {
'h264-ts': false,
h264: true,
h265: true,
+ av1: true,
aac: false,
gif: false,
mp3: false,
diff --git a/packages/renderer/src/crf.ts b/packages/renderer/src/crf.ts
index de679b62fb..b733782e77 100644
--- a/packages/renderer/src/crf.ts
+++ b/packages/renderer/src/crf.ts
@@ -10,6 +10,7 @@ const defaultCrfMap: {[key in Codec]: number | null} = {
h265: 23,
vp8: 9,
vp9: 28,
+ av1: 30,
prores: null,
gif: null,
'h264-mkv': 18,
@@ -33,6 +34,7 @@ const crfRanges: {[key in Codec]: [number, number]} = {
h265: [0, 51],
vp8: [4, 63],
vp9: [0, 63],
+ av1: [0, 63],
prores: [0, 0],
gif: [0, 0],
'h264-mkv': [1, 51],
diff --git a/packages/renderer/src/file-extensions.ts b/packages/renderer/src/file-extensions.ts
index 818eeeb828..2d50255b05 100644
--- a/packages/renderer/src/file-extensions.ts
+++ b/packages/renderer/src/file-extensions.ts
@@ -76,6 +76,14 @@ export const defaultFileExtensionMap: {
'pcm-16': {possible: ['mkv'], default: 'mkv'},
},
},
+ av1: {
+ default: 'mp4',
+ forAudioCodec: {
+ aac: {possible: ['mp4', 'mkv'], default: 'mp4'},
+ opus: {possible: ['webm', 'mkv'], default: 'webm'},
+ 'pcm-16': {possible: ['mkv'], default: 'mkv'},
+ },
+ },
mp3: {
default: 'mp3',
forAudioCodec: {
diff --git a/packages/renderer/src/get-codec-name.ts b/packages/renderer/src/get-codec-name.ts
index 26998e2aa9..25cff3e615 100644
--- a/packages/renderer/src/get-codec-name.ts
+++ b/packages/renderer/src/get-codec-name.ts
@@ -125,6 +125,14 @@ export const getCodecName = ({
return {encoderName: 'libvpx-vp9', hardwareAccelerated: false};
}
+ if (codec === 'av1') {
+ Log.warn(
+ {indent, logLevel},
+ 'AV1 encoding is significantly slower than other codecs.',
+ );
+ return {encoderName: 'libaom-av1', hardwareAccelerated: false};
+ }
+
if (codec === 'gif') {
return {encoderName: 'gif', hardwareAccelerated: false};
}
diff --git a/packages/renderer/src/options/audio-codec.tsx b/packages/renderer/src/options/audio-codec.tsx
index 0a568d717b..49317c2fca 100644
--- a/packages/renderer/src/options/audio-codec.tsx
+++ b/packages/renderer/src/options/audio-codec.tsx
@@ -14,6 +14,7 @@ export const supportedAudioCodecs = {
avi: [] as const,
gif: [] as const,
h265: ['aac', 'pcm-16'] as const,
+ av1: ['aac', 'opus', 'pcm-16'] as const,
mp3: ['mp3', 'pcm-16'] as const,
prores: ['aac', 'pcm-16'] as const,
vp8: ['opus', 'pcm-16'] as const,
@@ -93,6 +94,10 @@ export const defaultAudioCodecs: {
lossless: 'pcm-16',
compressed: 'aac',
},
+ av1: {
+ lossless: 'pcm-16',
+ compressed: 'aac',
+ },
mp3: {
lossless: 'pcm-16',
compressed: 'mp3',
diff --git a/packages/renderer/src/test/crf.test.ts b/packages/renderer/src/test/crf.test.ts
index 80d9f26b60..f5e55f237d 100644
--- a/packages/renderer/src/test/crf.test.ts
+++ b/packages/renderer/src/test/crf.test.ts
@@ -13,6 +13,7 @@ describe('crf tests getValidCrfRanges valid input', () => {
['h265', [0, 51]],
['vp8', [4, 63]],
['vp9', [0, 63]],
+ ['av1', [0, 63]],
['mp3', [0, 0]],
['aac', [0, 0]],
['wav', [0, 0]],
@@ -38,6 +39,9 @@ describe('validateSelectedCrfAndCodecCombination valid input', () => {
[20, 'vp9'],
[0, 'vp9'],
[63, 'vp9'],
+ [20, 'av1'],
+ [0, 'av1'],
+ [63, 'av1'],
] as [number, Codec][];
validInputs.forEach((entry) =>
test(`validate with crf ${entry[0]} and codec ${entry[1]}`, () =>
@@ -69,6 +73,9 @@ describe('validateSelectedCrfAndCodecCombination invalid input', () => {
[80, 'vp9', [0, 63]],
[-1, 'vp9', [0, 63]],
[64, 'vp9', [0, 63]],
+ [80, 'av1', [0, 63]],
+ [-1, 'av1', [0, 63]],
+ [64, 'av1', [0, 63]],
] as [number, Codec, [number, number]][];
invalidInputs.forEach((entry) =>
test(`validate with crf ${entry[0]} and codec ${entry[1]}`, () =>
diff --git a/packages/renderer/src/test/derive-codec-from-file-extension.test.ts b/packages/renderer/src/test/derive-codec-from-file-extension.test.ts
index e5466e98bb..01f9a4c9e6 100644
--- a/packages/renderer/src/test/derive-codec-from-file-extension.test.ts
+++ b/packages/renderer/src/test/derive-codec-from-file-extension.test.ts
@@ -3,7 +3,7 @@ import {makeFileExtensionMap} from '../get-extension-from-codec';
test('Derive codec from file extension', () => {
expect(makeFileExtensionMap()).toEqual({
- mkv: ['h264-mkv', 'h264', 'h265', 'prores', 'vp8', 'vp9'],
+ mkv: ['h264-mkv', 'h264', 'h265', 'av1', 'prores', 'vp8', 'vp9'],
aac: ['aac'],
'3gp': ['aac'],
m4a: ['aac'],
@@ -11,12 +11,12 @@ test('Derive codec from file extension', () => {
mpg: ['aac'],
mpeg: ['aac'],
gif: ['gif'],
- mp4: ['h264', 'h265'],
+ mp4: ['h264', 'h265', 'av1'],
hevc: ['h265'],
mp3: ['mp3'],
mov: ['h264', 'prores'],
mxf: ['prores'],
- webm: ['vp8', 'vp9'],
+ webm: ['av1', 'vp8', 'vp9'],
wav: ['aac', 'mp3', 'wav'],
ts: ['h264-ts'],
});
diff --git a/packages/renderer/src/test/pixel-format.test.ts b/packages/renderer/src/test/pixel-format.test.ts
index fb52f2ced5..a04cec60da 100644
--- a/packages/renderer/src/test/pixel-format.test.ts
+++ b/packages/renderer/src/test/pixel-format.test.ts
@@ -13,7 +13,7 @@ describe('pixel-format tests validateSelectedPixelFormatAndCodecCombination', ()
'yuv444p10le',
];
- const codecs: Codec[] = ['h264', 'h265', 'vp8', 'vp9'];
+ const codecs: Codec[] = ['h264', 'h265', 'av1', 'vp8', 'vp9'];
for (const format of formats) {
for (const codec of codecs) {
@@ -31,6 +31,12 @@ describe('pixel-format tests validateSelectedPixelFormatAndCodecCombination', ()
).toThrow(
/Pixel format was set to 'yuva420p' but codec h264 does not support it. Valid pixel formats for codec h264 are: yuv420p, yuv422p, yuv444p, yuv420p10le, yuv422p10le, yuv444p10le, yuva444p10le./g,
));
+ test(`test for invalid combination yuva420p and av1`, () =>
+ expect(() =>
+ validateSelectedPixelFormatAndCodecCombination('yuva420p', 'av1'),
+ ).toThrow(
+ /Pixel format was set to 'yuva420p' but codec av1 does not support it. Valid pixel formats for codec av1 are: yuv420p, yuv422p, yuv444p, yuv420p10le, yuv422p10le, yuv444p10le, yuva444p10le./g,
+ ));
const validCodecs: Codec[] = ['vp8', 'vp9'];
validCodecs.forEach((c) =>
test(`test for valid combination yuva420p and ${c}`, () =>
diff --git a/packages/renderer/src/test/validate-even-dimensions-with-codec.test.ts b/packages/renderer/src/test/validate-even-dimensions-with-codec.test.ts
index a790691e1c..89214084d8 100644
--- a/packages/renderer/src/test/validate-even-dimensions-with-codec.test.ts
+++ b/packages/renderer/src/test/validate-even-dimensions-with-codec.test.ts
@@ -8,7 +8,7 @@ describe('validateEvenDimensionsWithCodec', () => {
wantsImageSequence: false,
};
- describe('H264/H265 codec behavior with odd dimensions', () => {
+ describe('H264/H265/AV1 codec behavior with odd dimensions', () => {
test('should round down odd width to even when using H264', () => {
const result = validateEvenDimensionsWithCodec({
width: 4000,
@@ -48,6 +48,19 @@ describe('validateEvenDimensionsWithCodec', () => {
expect(result.actualHeight).toBe(300); // 301 (odd) -> 300 (even)
});
+ test('should round down odd dimensions when using AV1', () => {
+ const result = validateEvenDimensionsWithCodec({
+ width: 301,
+ height: 201,
+ scale: 1,
+ codec: 'av1',
+ ...defaultConfig,
+ });
+
+ expect(result.actualWidth).toBe(300); // 301 (odd) -> 300 (even)
+ expect(result.actualHeight).toBe(200); // 201 (odd) -> 200 (even)
+ });
+
test('should round down both dimensions when both are odd', () => {
const result = validateEvenDimensionsWithCodec({
width: 301,
@@ -114,6 +127,19 @@ describe('validateEvenDimensionsWithCodec', () => {
expect(result.actualWidth).toBe(1000);
expect(result.actualHeight).toBe(600);
});
+
+ test('should keep even dimensions as-is for AV1', () => {
+ const result = validateEvenDimensionsWithCodec({
+ width: 1000,
+ height: 600,
+ scale: 0.5,
+ codec: 'av1',
+ ...defaultConfig,
+ });
+
+ expect(result.actualWidth).toBe(1000);
+ expect(result.actualHeight).toBe(600);
+ });
});
describe('Other codecs should not be affected', () => {
diff --git a/packages/renderer/src/validate-even-dimensions-with-codec.ts b/packages/renderer/src/validate-even-dimensions-with-codec.ts
index 55b27343ee..885ee14c0f 100644
--- a/packages/renderer/src/validate-even-dimensions-with-codec.ts
+++ b/packages/renderer/src/validate-even-dimensions-with-codec.ts
@@ -30,6 +30,7 @@ export const validateEvenDimensionsWithCodec = ({
codec !== 'h264-mkv' &&
codec !== 'h264' &&
codec !== 'h265' &&
+ codec !== 'av1' &&
codec !== 'h264-ts'
) {
return {
diff --git a/packages/studio/src/components/RenderModal/human-readable-codec.ts b/packages/studio/src/components/RenderModal/human-readable-codec.ts
index c756be3afe..4bf84cb378 100644
--- a/packages/studio/src/components/RenderModal/human-readable-codec.ts
+++ b/packages/studio/src/components/RenderModal/human-readable-codec.ts
@@ -29,6 +29,10 @@ export const humanReadableCodec = (codec: Codec) => {
return 'H.265';
}
+ if (codec === 'av1') {
+ return 'AV1';
+ }
+
if (codec === 'prores') {
return 'ProRes';
}