Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile-aws
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ RUN yum install yasm nasm unzip curl gcc gcc-c++ tar git make ca-certificates pk
RUN cd app && CFLAGS="$CFLAGS -static-libgcc" CXXFLAGS="$CXXFLAGS -static-libgcc -static-libstdc++" LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" node compile-ffmpeg.mjs old-cmake
RUN source "$HOME/.cargo/env" && cd app && node generate-bindings.mjs
RUN source "$HOME/.cargo/env" && cd app && node zip.mjs
RUN source "$HOME/.cargo/env" && cd app && node test-ffmpeg.mjs
RUN source "$HOME/.cargo/env" && cd app && EXPECT_AV1_ENCODER=0 node test-ffmpeg.mjs

9 changes: 7 additions & 2 deletions compile-av1.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ const enableLibaom = (isWindows) => {
});
};

export const enableAv1 = (isWindows) => {
export const enableAv1 = ({
isWindows,
enableEncoder,
}) => {
enableDav1d(isWindows);
enableLibaom(isWindows);
if (enableEncoder) {
enableLibaom(isWindows);
}
};
12 changes: 9 additions & 3 deletions compile-ffmpeg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,15 @@ if (!existsSync(PREFIX)) {
const isWindows = process.argv.includes("windows");
const isMusl = process.argv.includes("musl");
const isOldCmake = process.argv.includes("old-cmake");
const isLambdaTarget =
process.platform === "linux" &&
process.arch === "arm64" &&
!isMusl &&
!isWindows;
const shouldEnableAv1Encoder = !isLambdaTarget;

await enableFdkAac(isWindows);
enableAv1(isWindows);
enableAv1({ isWindows, enableEncoder: shouldEnableAv1Encoder });
enableZimg(isWindows);
enableVpx(isWindows);
enableX264(isMusl, isWindows);
Expand Down Expand Up @@ -216,7 +222,7 @@ execSync(
"--enable-small",
"--enable-shared",
"--enable-libdav1d",
"--enable-libaom",
shouldEnableAv1Encoder ? "--enable-libaom" : null,
"--enable-libzimg",
"--enable-libfdk-aac",
"--disable-static",
Expand Down Expand Up @@ -267,7 +273,7 @@ execSync(
"--enable-encoder=pcm_s24le",
"--enable-encoder=libx264",
"--enable-encoder=libx265",
"--enable-encoder=libaom_av1",
shouldEnableAv1Encoder ? "--enable-encoder=libaom_av1" : null,
"--enable-libvpx",
"--enable-encoder=libvpx_vp8",
"--enable-encoder=libvpx_vp9",
Expand Down
45 changes: 25 additions & 20 deletions test-ffmpeg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const env =
};

const ffmpegBinary = path.join(process.cwd(), "remotion", "bin", "ffmpeg");
const shouldHaveAv1Encoder = process.env.EXPECT_AV1_ENCODER !== "0";

const exit1 = spawnSync(ffmpegBinary, ["-buildconf"], {
env,
Expand All @@ -39,7 +40,9 @@ if (encoders.status !== 0) {
console.log(encoders.stdout.toString("utf8"));
}
assert(encoders.status === 0);
assert(encoders.stdout.toString("utf8").includes("libaom-av1"));
assert(
encoders.stdout.toString("utf8").includes("libaom-av1") === shouldHaveAv1Encoder
);

const exit2 = spawnSync(
ffmpegBinary,
Expand Down Expand Up @@ -154,23 +157,25 @@ const exit6 = spawnSync(
);
assert(exit6.status === 0);

const exit7 = spawnSync(
ffmpegBinary,
[
"-i",
"sample.mp4",
"-frames:v",
"1",
"-an",
"-c:v",
"libaom-av1",
"out-test-libaom-av1.mkv",
"-y",
],
{
env,
stdio: "inherit",
}
);
assert(exit7.status === 0);
if (shouldHaveAv1Encoder) {
const exit7 = spawnSync(
ffmpegBinary,
[
"-i",
"sample.mp4",
"-frames:v",
"1",
"-an",
"-c:v",
"libaom-av1",
"out-test-libaom-av1.mkv",
"-y",
],
{
env,
stdio: "inherit",
}
);
assert(exit7.status === 0);
}
console.log("Hooray!");
Loading