Skip to content
Open
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
8 changes: 8 additions & 0 deletions compile-ffmpeg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { enableAv1 } from "./compile-av1.mjs";
import { enableFdkAac } from "./compile-fdkaac.mjs";
import { enableZimg } from "./compile-zimg.mjs";
import { fixLinuxLinks } from "./fix-linux-links.mjs";
import { enableNvencHeaders } from "./compile-nvenc.mjs";

if (existsSync("/opt/homebrew/opt/libx11/lib/libX11.6.dylib")) {
console.log(
Expand Down Expand Up @@ -137,6 +138,7 @@ enableX264(isMusl, isWindows);
enableX265(isMusl, isWindows, isOldCmake);
enableLibMp3Lame(isWindows);
enableOpus(isWindows);
enableNvencHeaders(isWindows);

const TAG = "n7.1";

Expand Down Expand Up @@ -288,6 +290,12 @@ execSync(
process.platform === "darwin"
? "--enable-encoder=prores_videotoolbox"
: null,
!isWindows && process.platform === "linux"
? "--enable-encoder=h264_nvenc"
: null,
!isWindows && process.platform === "linux"
? "--enable-encoder=hevc_nvenc"
: null,
"--disable-muxers",
"--enable-muxer=webm,opus,mp4,wav,mp3,mov,matroska,hevc,h264,gif,image2,image2pipe,adts,m4a,mpegts,null,avi",
"--enable-libx264",
Expand Down
33 changes: 33 additions & 0 deletions compile-nvenc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { execSync } from "child_process";
import { existsSync } from "fs";
import { PREFIX } from "./const.mjs";

const NV_CODEC_HEADERS_TAG = "n12.2.16.0";

export const enableNvencHeaders = (isWindows) => {
// Only install on native Linux builds (not macOS, not Windows cross-compile)
// nv-codec-headers are header-only - no runtime dependency at build time
if (process.platform !== "linux" || isWindows) return;

if (!existsSync("nv-codec-headers")) {
execSync(
"git clone https://github.com/FFmpeg/nv-codec-headers.git",
{stdio: "inherit"},
);
}

execSync("git fetch --all --tags", {
cwd: "nv-codec-headers",
stdio: "inherit",
});

execSync(`git checkout ${NV_CODEC_HEADERS_TAG}`, {
cwd: "nv-codec-headers",
stdio: "inherit",
});

execSync(`make install PREFIX=${PREFIX}`, {
cwd: "nv-codec-headers",
stdio: "inherit",
});
};
Loading