diff --git a/.circleci/config.yml b/.circleci/config.yml index 96b01ff..806f670 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,10 +21,11 @@ jobs: keys: - ffmpeg_source-linux-x64 - run: sudo apt-get update - - run: sudo apt-get install -y yasm nasm clang cargo make zlib1g-dev meson ninja-build autoconf automake libtool patchelf + - run: curl https://sh.rustup.rs -sSf | sh -s -- -y + - run: sudo apt-get install -y yasm nasm clang make zlib1g-dev meson ninja-build autoconf automake libtool patchelf - run: node clean.mjs - run: node compile-ffmpeg.mjs - - run: node generate-bindings.mjs + - run: source "$HOME/.cargo/env" && node generate-bindings.mjs - run: node zip.mjs - run: node test-ffmpeg.mjs - store_artifacts: @@ -63,7 +64,7 @@ jobs: - ffmpeg build-linux-arm-gnu: machine: - image: ubuntu-2004:202101-01 + image: ubuntu-2004:2024.05.1 resource_class: arm.medium steps: - checkout @@ -87,7 +88,7 @@ jobs: - ffmpeg build-linux-arm-musl: machine: - image: ubuntu-2004:202101-01 + image: ubuntu-2004:2024.05.1 resource_class: arm.medium steps: - checkout @@ -121,7 +122,7 @@ jobs: keys: - ffmpeg_source-windows - run: sudo apt-get update - - run: sudo apt-get install -y yasm nasm mingw-w64 mingw-w64-tools libz-mingw-w64-dev cargo clang build-essential zlib1g zlib1g-dev meson ninja-build autoconf automake libtool + - run: sudo apt-get install -y yasm nasm mingw-w64 mingw-w64-tools libz-mingw-w64-dev clang build-essential zlib1g zlib1g-dev meson ninja-build autoconf automake libtool - run: curl https://sh.rustup.rs -sSf | sh -s -- -y - run: source "$HOME/.cargo/env" && rustup target add x86_64-pc-windows-gnu - run: node clean.mjs @@ -143,7 +144,7 @@ jobs: build-macos: macos: - xcode: 12.5.1 + xcode: 13.4.1 steps: - checkout - node/install: @@ -151,7 +152,7 @@ jobs: - restore_cache: keys: - ffmpeg_source-macos - - run: brew install yasm nasm pkg-config cmake make meson ninja libtool + - run: brew install yasm nasm pkg-config cmake make meson ninja libtool automake gcc - run: curl https://sh.rustup.rs -sSf | sh -s -- -y - run: node clean.mjs - run: node compile-ffmpeg.mjs diff --git a/Cargo.lock b/Cargo.lock index 5f8a881..f888744 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,35 +4,14 @@ version = 3 [[package]] name = "bindgen" -version = "0.59.2" +version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ "bitflags", "cexpr", "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", -] - -[[package]] -name = "bindgen" -version = "0.64.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", + "itertools", "proc-macro2", "quote", "regex", @@ -43,15 +22,15 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "cc" -version = "1.0.79" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "e9e8aabfac534be767c909e0690571677d49f41bd8465ae876fe043d52ba5292" [[package]] name = "cexpr" @@ -79,10 +58,16 @@ dependencies = [ "libloading", ] +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "ffmpeg-next" -version = "6.0.0" -source = "git+https://github.com/JonnyBurger/rust-ffmpeg-upstream?rev=8ac86804d137223c84cf3305f82b5055239a92ba#8ac86804d137223c84cf3305f82b5055239a92ba" +version = "7.1.0" +source = "git+https://github.com/zmwangx/rust-ffmpeg?rev=a7b50dd5f909e071affffe238d434d184da30aee#a7b50dd5f909e071affffe238d434d184da30aee" dependencies = [ "bitflags", "ffmpeg-sys-next", @@ -93,16 +78,17 @@ dependencies = [ name = "ffmpeg-splitter" version = "0.1.0" dependencies = [ - "bindgen 0.59.2", + "bindgen", "ffmpeg-next", ] [[package]] name = "ffmpeg-sys-next" -version = "6.0.1" -source = "git+https://github.com/JonnyBurger/rust-ffmpeg-sys-upstream?rev=37f70da9763aec5845e520b9f3b59686d9f08621#37f70da9763aec5845e520b9f3b59686d9f08621" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc3234d0a4b2f7d083699d0860c6c9dd83713908771b60f94a96f8704adfe45" dependencies = [ - "bindgen 0.64.0", + "bindgen", "cc", "libc", "num_cpus", @@ -118,24 +104,18 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] -name = "lazycell" -version = "1.3.0" +name = "itertools" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] [[package]] name = "libc" @@ -177,20 +157,14 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", ] -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pkg-config" version = "0.3.26" @@ -199,18 +173,18 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -244,9 +218,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index fbb8c54..3709606 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ name = "split" path = "main.rs" [dependencies] -ffmpeg-next = { git = "https://github.com/JonnyBurger/rust-ffmpeg-upstream", rev = "8ac86804d137223c84cf3305f82b5055239a92ba" } -bindgen = { version = "0.59", default-features = false, features = ["runtime"] } +ffmpeg-next = { git = "https://github.com/zmwangx/rust-ffmpeg", rev = "a7b50dd5f909e071affffe238d434d184da30aee" } +bindgen = { version = "0.70", default-features = false, features = ["runtime"] } [profile.dev] rpath = true diff --git a/Dockerfile b/Dockerfile index 04a6a93..5d8bb00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ COPY opus.gz app/opus.gz COPY sample-5s.webm app/sample-5s.webm COPY sample.mp4 app/sample.mp4 COPY sample-av1.webm app/sample-av1.webm -COPY prores.patch app/prores.patch COPY aac.patch app/aac.patch RUN apk add curl diff --git a/Dockerfile-aws b/Dockerfile-aws index c6ec0a8..7967263 100644 --- a/Dockerfile-aws +++ b/Dockerfile-aws @@ -11,7 +11,6 @@ COPY opus.gz app/opus.gz COPY sample-5s.webm app/sample-5s.webm COPY sample.mp4 app/sample.mp4 COPY sample-av1.webm app/sample-av1.webm -COPY prores.patch app/prores.patch COPY aac.patch app/aac.patch RUN curl https://sh.rustup.rs -sSf | sh -s -- -y diff --git a/aac.patch b/aac.patch index ccdb6a2..fe1fef7 100644 --- a/aac.patch +++ b/aac.patch @@ -1,13 +1,13 @@ diff --git a/fftools/ffmpeg_dec.c b/fftools/ffmpeg_dec.c -index fcee8b65ac..07edcef4f2 100644 +index 2723a0312e..8d5c7e68f6 100644 --- a/fftools/ffmpeg_dec.c +++ b/fftools/ffmpeg_dec.c -@@ -214,7 +214,7 @@ static void audio_ts_process(void *logctx, Decoder *d, AVFrame *frame) +@@ -252,7 +252,7 @@ static void audio_ts_process(DecoderPriv *dp, AVFrame *frame) // on samplerate change, choose a new internal timebase for timestamp // generation that can represent timestamps from all the samplerates // seen so far -- tb = audio_samplerate_update(logctx, d, frame); +- tb = audio_samplerate_update(dp, frame); + tb = frame->time_base; - pts_pred = d->last_frame_pts == AV_NOPTS_VALUE ? 0 : - d->last_frame_pts + d->last_frame_duration_est; + pts_pred = dp->last_frame_pts == AV_NOPTS_VALUE ? 0 : + dp->last_frame_pts + dp->last_frame_duration_est; diff --git a/compile-ffmpeg.mjs b/compile-ffmpeg.mjs index ae96c8e..531503a 100644 --- a/compile-ffmpeg.mjs +++ b/compile-ffmpeg.mjs @@ -128,7 +128,7 @@ enableX265(isMusl, isWindows); enableLibMp3Lame(isWindows); enableOpus(isWindows); -const TAG = "n6.1"; +const TAG = "n7.1"; if (fs.existsSync("ffmpeg")) { execSync("git stash", { @@ -147,9 +147,6 @@ if (fs.existsSync("ffmpeg")) { cwd: "ffmpeg", stdio: "inherit", }); - execSync("git apply prores.patch --directory ffmpeg", { - stdio: "inherit", - }); execSync("git apply aac.patch --directory ffmpeg", { stdio: "inherit", }); @@ -161,9 +158,6 @@ if (fs.existsSync("ffmpeg")) { cwd: "ffmpeg", stdio: "inherit", }); - execSync("git apply prores.patch --directory ffmpeg", { - stdio: "inherit", - }); execSync("git apply aac.patch --directory ffmpeg", { stdio: "inherit", }); @@ -180,9 +174,7 @@ const extraCFlags = [ const extraLdFlags = [ "-L" + PREFIX + "/lib", - process.platform === "darwin" && process.arch === "arm64" - ? "-Wl,-ld_classic" - : null, + process.platform === "darwin" && process.arch === "arm64" ? "-Wl" : null, ].filter(Boolean); execSync("cp -r remotion ffmpeg", { stdio: "inherit" }); diff --git a/prores.patch b/prores.patch deleted file mode 100644 index b344f29..0000000 --- a/prores.patch +++ /dev/null @@ -1,16 +0,0 @@ - libavcodec/proresenc_kostya.c | 3 +-- - 2 files changed, 2 insertions(+), 4 deletions(-) -diff --git a/libavcodec/proresenc_kostya.c b/libavcodec/proresenc_kostya.c -index e904632f8e..8d45e42d1a 100644 ---- a/libavcodec/proresenc_kostya.c -+++ b/libavcodec/proresenc_kostya.c -@@ -562,8 +562,7 @@ static void encode_alpha_plane(ProresContext *ctx, PutBitContext *pb, - run++; - } - } while (idx < num_coeffs); -- if (run) -- put_alpha_run(pb, run); -+ put_alpha_run(pb, run); - } - - static int encode_slice(AVCodecContext *avctx, const AVFrame *pic,