Skip to content

Instantly share code, notes, and snippets.

@valpackett
Created December 31, 2025 23:15
Show Gist options
  • Select an option

  • Save valpackett/edcf3dad8b48327a8da5cbdb1d426bb9 to your computer and use it in GitHub Desktop.

Select an option

Save valpackett/edcf3dad8b48327a8da5cbdb1d426bb9 to your computer and use it in GitHub Desktop.
freedesktop-sdk rpi-ffmpeg patch on top of 9673d931e0bbd4
diff --git a/elements/include/ffmpeg.yml b/elements/include/ffmpeg.yml
index 5d4983fea5..626c7e7f94 100644
--- a/elements/include/ffmpeg.yml
+++ b/elements/include/ffmpeg.yml
@@ -11,6 +11,7 @@
- components/fribidi.bst
- components/lame.bst
- components/libjxl.bst
+- components/libdrm.bst
- components/libva.bst
- components/libvdpau.bst
- components/librsvg.bst
@@ -61,6 +62,7 @@
--enable-lcms2
--enable-libaom
--enable-libdav1d
+ --enable-libdrm
--enable-libmp3lame
--enable-libfontconfig
--enable-libfreetype
@@ -86,6 +88,8 @@
--enable-libxcb
--enable-vdpau
--enable-vaapi
+ --enable-v4l2-m2m
+ --enable-v4l2-request
--enable-pthreads
--enable-libopenh264
--arch="%{ffmpeg-arch}"
@@ -115,10 +119,9 @@
sources:
- kind: git_repo
- url: ffmpeg:ffmpeg.git
- track: n7.0.*
+ url: github:jc-kynesim/rpi-ffmpeg.git
exclude:
- '*-dev'
- ref: n7.0.3-0-geaddd1d7140bab19e5a4403d3c0f61fe5f59cb75
+ ref: 857f6c0ab47578dbd4153b4ed41eefbd488fd7fe
- kind: patch_queue
path: patches/ffmpeg
diff --git a/patches/ffmpeg/0001-avcodec-loongarch-Makefile-Fix-vc1dsp_lasx.o-build-c.patch b/patches/ffmpeg/0001-avcodec-loongarch-Makefile-Fix-vc1dsp_lasx.o-build-c.patch
deleted file mode 100644
index 3cae19a21d..0000000000
--- a/patches/ffmpeg/0001-avcodec-loongarch-Makefile-Fix-vc1dsp_lasx.o-build-c.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From b515088576bbeb746aa34a222bba76cc01b29e44 Mon Sep 17 00:00:00 2001
-From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-Date: Sat, 15 Jun 2024 20:29:09 +0200
-Subject: [PATCH] avcodec/loongarch/Makefile: Fix vc1dsp_lasx.o build criterion
-
-Fixes ticket #11057.
-
-Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
----
- libavcodec/loongarch/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libavcodec/loongarch/Makefile b/libavcodec/loongarch/Makefile
-index 07da2964e4..92c8b35906 100644
---- a/libavcodec/loongarch/Makefile
-+++ b/libavcodec/loongarch/Makefile
-@@ -12,7 +12,7 @@ OBJS-$(CONFIG_HEVC_DECODER) += loongarch/hevcdsp_init_loongarch.o
- LASX-OBJS-$(CONFIG_H264QPEL) += loongarch/h264qpel_lasx.o
- LASX-OBJS-$(CONFIG_H264DSP) += loongarch/h264dsp_lasx.o \
- loongarch/h264_deblock_lasx.o
--LASX-OBJS-$(CONFIG_VC1_DECODER) += loongarch/vc1dsp_lasx.o
-+LASX-OBJS-$(CONFIG_VC1DSP) += loongarch/vc1dsp_lasx.o
- LASX-OBJS-$(CONFIG_HPELDSP) += loongarch/hpeldsp_lasx.o
- LASX-OBJS-$(CONFIG_IDCTDSP) += loongarch/simple_idct_lasx.o \
- loongarch/idctdsp_lasx.o
---
-2.45.2
-
diff --git a/patches/ffmpeg/libavcodec-vulkan-decode-nvidia.patch b/patches/ffmpeg/libavcodec-vulkan-decode-nvidia.patch
deleted file mode 100644
index e5bf96feb0..0000000000
--- a/patches/ffmpeg/libavcodec-vulkan-decode-nvidia.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 06708bd640369de11ab28ab15b276157eade5a3e Mon Sep 17 00:00:00 2001
-From: Lynne <dev@lynne.ee>
-Date: Sat, 10 Aug 2024 17:13:57 +0200
-Subject: [PATCH] vulkan_decode: force layered_dpb to 0 when dedicated_dpb is 0
-
-layered_dpb only makes sense when dedicated_dpb is set to 1.
-For some mysterious reason, some Nvidia drivers stopped indicating
-SEPARATE_REFRENCES, but kept the COINCIDE flag, which broke
-the code.
----
- libavcodec/vulkan_decode.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
-index 5f6523920d..7c791e9af1 100644
---- a/libavcodec/vulkan_decode.c
-+++ b/libavcodec/vulkan_decode.c
-@@ -911,9 +911,9 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_
- return AVERROR_EXTERNAL;
- }
-
-- /* TODO: make dedicated_dpb tunable */
- dec->dedicated_dpb = !(dec_caps->flags & VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR);
-- dec->layered_dpb = !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR);
-+ dec->layered_dpb = !dec->dedicated_dpb ? 0 :
-+ !(caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR);
-
- if (dec->dedicated_dpb) {
- fmt_info.imageUsage = VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
---
-2.49.0
-
diff --git a/patches/ffmpeg/v4l2-size.patch b/patches/ffmpeg/v4l2-size.patch
new file mode 100644
index 0000000000..c466b1e01e
--- /dev/null
+++ b/patches/ffmpeg/v4l2-size.patch
@@ -0,0 +1,23 @@
+https://github.com/jc-kynesim/rpi-ffmpeg/issues/103
+diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
+index e20e3e485c..1fdedb1686 100644
+--- a/libavcodec/v4l2_context.c
++++ b/libavcodec/v4l2_context.c
+@@ -283,11 +283,17 @@
+
+ static inline void v4l2_save_to_context(V4L2Context* ctx, struct v4l2_format_update *fmt)
+ {
++ V4L2m2mContext * const s = ctx_to_m2mctx(ctx);
+ ctx->format.type = ctx->type;
+
+ if (fmt->update_avfmt)
+ ctx->av_pix_fmt = fmt->av_fmt;
+
++ if (ctx->height == 0 || ctx->width == 0) {
++ ctx->width = s->avctx->width;
++ ctx->height = s->avctx->height;
++ }
++
+ if (V4L2_TYPE_IS_MULTIPLANAR(ctx->type)) {
+ /* update the sizes to handle the reconfiguration of the capture stream at runtime */
+ ctx->format.fmt.pix_mp.height = ctx->height;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment