From aabda35aa82b897133e09dd0b5e7e6eece9763db Mon Sep 17 00:00:00 2001 From: Andy Grundman Date: Sat, 21 Mar 2026 13:40:41 -0400 Subject: [PATCH] feat(ffmpeg): update ffmpeg to 8.1, nv-codec-headers to SDK 13.0 These patches were applied upstream: 01-amf-outputdelay.patch, 03-size-specifier.patch, 01-mfenc-lowlatency.patch Diffs refreshed for: 01-explicit-intmath.patch, 02-remove-register.patch --- .gitmodules | 18 ++--- .../FFmpeg/AMF/01-amf-outputdelay.patch | 35 ---------- .../FFmpeg/MF/01-mfenc-lowlatency.patch | 28 -------- .../FFmpeg/cbs/01-explicit-intmath.patch | 10 +-- .../FFmpeg/cbs/02-remove-register.patch | 14 ++-- .../FFmpeg/FFmpeg/cbs/03-size-specifier.patch | 68 ------------------- third-party/FFmpeg/FFmpeg | 2 +- third-party/FFmpeg/nv-codec-headers | 2 +- 8 files changed, 23 insertions(+), 154 deletions(-) delete mode 100644 patches/FFmpeg/FFmpeg/AMF/01-amf-outputdelay.patch delete mode 100644 patches/FFmpeg/FFmpeg/MF/01-mfenc-lowlatency.patch delete mode 100644 patches/FFmpeg/FFmpeg/cbs/03-size-specifier.patch diff --git a/.gitmodules b/.gitmodules index 03e0bad45..c1b61b6b6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,39 +2,39 @@ path = third-party/FFmpeg/AMF url = https://github.com/GPUOpen-LibrariesAndSDKs/AMF.git branch = master - shallow = true + shallow = true [submodule "third-party/FFmpeg/x264"] path = third-party/FFmpeg/x264 url = https://github.com/LizardByte-infrastructure/x264.git branch = master - shallow = true + shallow = true [submodule "third-party/FFmpeg/x265_git"] path = third-party/FFmpeg/x265_git url = https://github.com/LizardByte-infrastructure/x265_git.git branch = stable - shallow = true + shallow = true [submodule "third-party/FFmpeg/nv-codec-headers"] path = third-party/FFmpeg/nv-codec-headers url = https://github.com/FFmpeg/nv-codec-headers.git - branch = sdk/12.0 - shallow = true + branch = master + shallow = true [submodule "third-party/FFmpeg/FFmpeg"] path = third-party/FFmpeg/FFmpeg url = https://github.com/FFmpeg/FFmpeg.git branch = release/8.0 - shallow = true + shallow = true [submodule "third-party/FFmpeg/SVT-AV1"] path = third-party/FFmpeg/SVT-AV1 url = https://github.com/LizardByte-infrastructure/SVT-AV1.git branch = master - shallow = true + shallow = true [submodule "third-party/FFmpeg/Vulkan-Headers"] path = third-party/FFmpeg/Vulkan-Headers url = https://github.com/KhronosGroup/Vulkan-Headers.git branch = main - shallow = true + shallow = true [submodule "third-party/FFmpeg/Vulkan-Loader"] path = third-party/FFmpeg/Vulkan-Loader url = https://github.com/KhronosGroup/Vulkan-Loader.git branch = main - shallow = true + shallow = true diff --git a/patches/FFmpeg/FFmpeg/AMF/01-amf-outputdelay.patch b/patches/FFmpeg/FFmpeg/AMF/01-amf-outputdelay.patch deleted file mode 100644 index 91ab2b053..000000000 --- a/patches/FFmpeg/FFmpeg/AMF/01-amf-outputdelay.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e0b38ef1a012ecdf684f80e215970a5cf8ccb5e2 Mon Sep 17 00:00:00 2001 -From: Cameron Gutman -Date: Sat, 9 Aug 2025 20:40:17 -0500 -Subject: [PATCH] avcodec/amfenc: fix output delayed by one frame - -Signed-off-by: Cameron Gutman ---- - libavcodec/amfenc.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c -index b16b642e4c..fb41aef90a 100644 ---- a/libavcodec/amfenc.c -+++ b/libavcodec/amfenc.c -@@ -634,7 +634,7 @@ static int amf_submit_frame(AVCodecContext *avctx, AVFrame *frame, AMFSurface - ret = av_fifo_write(ctx->timestamp_list, &frame->pts, 1); - if (ret < 0) - return ret; -- if(ctx->submitted_frame <= ctx->encoded_frame + max_b_frames + 1) -+ if(ctx->submitted_frame <= ctx->encoded_frame + max_b_frames) - return AVERROR(EAGAIN); // if frame just submiited - don't poll or wait - } - return 0; -@@ -700,7 +700,7 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) - if(ret != AVERROR_EOF){ - av_frame_free(&frame); - if(ret == AVERROR(EAGAIN)){ -- if(ctx->submitted_frame <= ctx->encoded_frame + max_b_frames + 1) // too soon to poll -+ if(ctx->submitted_frame <= ctx->encoded_frame + max_b_frames) // too soon to poll - return ret; - } - } --- -2.50.1.windows.1 - diff --git a/patches/FFmpeg/FFmpeg/MF/01-mfenc-lowlatency.patch b/patches/FFmpeg/FFmpeg/MF/01-mfenc-lowlatency.patch deleted file mode 100644 index 0e260263f..000000000 --- a/patches/FFmpeg/FFmpeg/MF/01-mfenc-lowlatency.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 126671e73065e29c9582e47bc74774af2200fc8f Mon Sep 17 00:00:00 2001 -From: Cameron Gutman -Date: Sun, 31 Aug 2025 16:05:15 -0500 -Subject: [PATCH] avcodec/mfenc: add AVLowLatencyMode support - -Set CODECAPI_AVLowLatencyMode when AV_CODEC_FLAG_LOW_DELAY is enabled on -the AVCodecContext. AVLowLatencyMode can acheive lower latency encoding -that may not be accessible using eAVScenarioInfo options alone. - -Signed-off-by: Cameron Gutman ---- - libavcodec/mfenc.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c -index 6f79386404502..541f7fb9612af 100644 ---- a/libavcodec/mfenc.c -+++ b/libavcodec/mfenc.c -@@ -876,6 +876,9 @@ static int mf_encv_output_adjust(AVCodecContext *avctx, IMFMediaType *type) - - if (c->opt_enc_scenario >= 0) - ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVScenarioInfo, FF_VAL_VT_UI4(c->opt_enc_scenario)); -+ -+ if (avctx->flags & AV_CODEC_FLAG_LOW_DELAY) -+ ICodecAPI_SetValue(c->codec_api, &ff_CODECAPI_AVLowLatencyMode, FF_VAL_VT_UI4(1)); - } - - return 0; diff --git a/patches/FFmpeg/FFmpeg/cbs/01-explicit-intmath.patch b/patches/FFmpeg/FFmpeg/cbs/01-explicit-intmath.patch index 98f033ed6..abe2738ba 100644 --- a/patches/FFmpeg/FFmpeg/cbs/01-explicit-intmath.patch +++ b/patches/FFmpeg/FFmpeg/cbs/01-explicit-intmath.patch @@ -1,19 +1,19 @@ Explicitly imports intmath as our subset of sources doesn't have it included diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c -index 458381f038..c4a6561706 100644 +index d05352c738..5e73ff2deb 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c -@@ -17,6 +17,7 @@ - */ +@@ -18,6 +18,7 @@ + #include "libavutil/attributes.h" #include "libavutil/avassert.h" +#include "libavutil/intmath.h" #include "libavutil/opt.h" #include "libavutil/pixfmt.h" diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c -index 2de74691cb..e3a5e5b5df 100644 +index bcf6144046..76698247cd 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -19,6 +19,7 @@ @@ -25,7 +25,7 @@ index 2de74691cb..e3a5e5b5df 100644 #include "bytestream.h" #include "cbs.h" diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c -index 0205bb47aa..7d4d0fd14d 100644 +index 4fc3061728..ccc8e6d34c 100644 --- a/libavcodec/cbs_sei_syntax_template.c +++ b/libavcodec/cbs_sei_syntax_template.c @@ -16,6 +16,8 @@ diff --git a/patches/FFmpeg/FFmpeg/cbs/02-remove-register.patch b/patches/FFmpeg/FFmpeg/cbs/02-remove-register.patch index baf779344..ad8557830 100644 --- a/patches/FFmpeg/FFmpeg/cbs/02-remove-register.patch +++ b/patches/FFmpeg/FFmpeg/cbs/02-remove-register.patch @@ -1,10 +1,10 @@ Register storage specifier is an error for modern compiler and generally ignored anyway. diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h -index fe2f6378b4..477bd11746 100644 +index a22c9755ae..354adb64c8 100644 --- a/libavcodec/get_bits.h +++ b/libavcodec/get_bits.h -@@ -291,8 +291,8 @@ static inline void skip_bits_long(GetBitContext *s, int n) +@@ -293,8 +293,8 @@ static inline void skip_bits_long(GetBitContext *s, int n) */ static inline int get_xbits(GetBitContext *s, int n) { @@ -15,7 +15,7 @@ index fe2f6378b4..477bd11746 100644 OPEN_READER(re, s); av_assert2(n>0 && n<=25); UPDATE_CACHE(re, s); -@@ -305,8 +305,8 @@ static inline int get_xbits(GetBitContext *s, int n) +@@ -307,8 +307,8 @@ static inline int get_xbits(GetBitContext *s, int n) static inline int get_xbits_le(GetBitContext *s, int n) { @@ -26,7 +26,7 @@ index fe2f6378b4..477bd11746 100644 OPEN_READER(re, s); av_assert2(n>0 && n<=25); UPDATE_CACHE_LE(re, s); -@@ -319,7 +319,7 @@ static inline int get_xbits_le(GetBitContext *s, int n) +@@ -321,7 +321,7 @@ static inline int get_xbits_le(GetBitContext *s, int n) static inline int get_sbits(GetBitContext *s, int n) { @@ -35,7 +35,7 @@ index fe2f6378b4..477bd11746 100644 OPEN_READER(re, s); av_assert2(n>0 && n<=25); UPDATE_CACHE(re, s); -@@ -334,7 +334,7 @@ static inline int get_sbits(GetBitContext *s, int n) +@@ -336,7 +336,7 @@ static inline int get_sbits(GetBitContext *s, int n) */ static inline unsigned int get_bits(GetBitContext *s, int n) { @@ -44,7 +44,7 @@ index fe2f6378b4..477bd11746 100644 OPEN_READER(re, s); av_assert2(n>0 && n<=25); UPDATE_CACHE(re, s); -@@ -355,7 +355,7 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n) +@@ -357,7 +357,7 @@ static av_always_inline int get_bitsz(GetBitContext *s, int n) static inline unsigned int get_bits_le(GetBitContext *s, int n) { @@ -53,7 +53,7 @@ index fe2f6378b4..477bd11746 100644 OPEN_READER(re, s); av_assert2(n>0 && n<=25); UPDATE_CACHE_LE(re, s); -@@ -370,7 +370,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n) +@@ -372,7 +372,7 @@ static inline unsigned int get_bits_le(GetBitContext *s, int n) */ static inline unsigned int show_bits(GetBitContext *s, int n) { diff --git a/patches/FFmpeg/FFmpeg/cbs/03-size-specifier.patch b/patches/FFmpeg/FFmpeg/cbs/03-size-specifier.patch deleted file mode 100644 index 25ca073bb..000000000 --- a/patches/FFmpeg/FFmpeg/cbs/03-size-specifier.patch +++ /dev/null @@ -1,68 +0,0 @@ -Patch macro in logs that isn't handled by ./configure - -diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c -index b26e39eab4..c83a87e2cb 100644 ---- a/libavcodec/cbs.c -+++ b/libavcodec/cbs.c -@@ -367,7 +367,7 @@ static int cbs_write_unit_data(CodedBitstreamContext *ctx, - if (ret < 0) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Unable to allocate a " - "sufficiently large write buffer (last attempt " -- "%"SIZE_SPECIFIER" bytes).\n", ctx->write_buffer_size); -+ "%zu bytes).\n", ctx->write_buffer_size); - return ret; - } - } -diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c -index 98d745f494..6ccc3b624e 100644 ---- a/libavcodec/cbs_av1.c -+++ b/libavcodec/cbs_av1.c -@@ -689,7 +689,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, - - if (INT_MAX / 8 < size) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid fragment: " -- "too large (%"SIZE_SPECIFIER" bytes).\n", size); -+ "too large (%zu bytes).\n", size); - err = AVERROR_INVALIDDATA; - goto fail; - } -@@ -740,7 +740,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, - if (obu_header.obu_has_size_field) { - if (get_bits_left(&gbc) < 8) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment " -- "too short (%"SIZE_SPECIFIER" bytes).\n", size); -+ "too short (%zu bytes).\n", size); - err = AVERROR_INVALIDDATA; - goto fail; - } -@@ -757,7 +757,7 @@ static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, - - if (size < obu_length) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: " -- "%"PRIu64", but only %"SIZE_SPECIFIER" bytes remaining in fragment.\n", -+ "%"PRIu64", but only %zu bytes remaining in fragment.\n", - obu_length, size); - err = AVERROR_INVALIDDATA; - goto fail; -@@ -836,7 +836,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx, - } else { - if (unit->data_size < 1 + obu->header.obu_extension_flag) { - av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: " -- "unit too short (%"SIZE_SPECIFIER").\n", unit->data_size); -+ "unit too short (%zu).\n", unit->data_size); - return AVERROR_INVALIDDATA; - } - obu->obu_size = unit->data_size - 1 - obu->header.obu_extension_flag; -diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c -index ff99fe32fb..0e94c336a5 100644 ---- a/libavcodec/cbs_vp9.c -+++ b/libavcodec/cbs_vp9.c -@@ -415,7 +415,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, - } - if (pos + index_size != frag->data_size) { - av_log(ctx->log_ctx, AV_LOG_WARNING, "Extra padding at " -- "end of superframe: %"SIZE_SPECIFIER" bytes.\n", -+ "end of superframe: %zu bytes.\n", - frag->data_size - (pos + index_size)); - } - diff --git a/third-party/FFmpeg/FFmpeg b/third-party/FFmpeg/FFmpeg index fa4ee7ab3..9047fa1b0 160000 --- a/third-party/FFmpeg/FFmpeg +++ b/third-party/FFmpeg/FFmpeg @@ -1 +1 @@ -Subproject commit fa4ee7ab3c1734795149f6dbc3746e834e859e8c +Subproject commit 9047fa1b084f76b1b4d065af2d743df1b40dfb56 diff --git a/third-party/FFmpeg/nv-codec-headers b/third-party/FFmpeg/nv-codec-headers index fe32761e7..e844e5b26 160000 --- a/third-party/FFmpeg/nv-codec-headers +++ b/third-party/FFmpeg/nv-codec-headers @@ -1 +1 @@ -Subproject commit fe32761e7a8bc79fcf560f356bf3898271bf4d56 +Subproject commit e844e5b26f46bb77479f063029595293aa8f812d