Bug#1115048: opencv: FTBFS with ffmpeg 8.0
Emilio Pozuelo Monfort
pochu at debian.org
Thu Dec 18 09:48:06 GMT 2025
Control: tags -1 patch
On Sat, 27 Sep 2025 16:34:30 +0200 Santiago Vila <sanvila at debian.org> wrote:
> tags 1115048 help
> thanks
>
> Hello. I found this is fixed upstream here:
>
> https://github.com/opencv/opencv/pull/27746/commits
>
> Unfortunately, it does not apply cleanly to opencv 4.10, so I'm
> tagging this as "help".
You were missing a preliminary patch. Attached debdiff that builds for me. Let
me know if I should upload it or if you will.
Cheers,
Emilio
-------------- next part --------------
diff -Nru opencv-4.10.0+dfsg/debian/changelog opencv-4.10.0+dfsg/debian/changelog
--- opencv-4.10.0+dfsg/debian/changelog 2025-09-27 16:40:00.000000000 +0200
+++ opencv-4.10.0+dfsg/debian/changelog 2025-12-18 09:48:35.000000000 +0100
@@ -1,3 +1,10 @@
+opencv (4.10.0+dfsg-6.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix build with ffmpeg 8.0. Closes: #1115048.
+
+ -- Emilio Pozuelo Monfort <pochu at debian.org> Thu, 18 Dec 2025 09:48:35 +0100
+
opencv (4.10.0+dfsg-6) unstable; urgency=medium
* Team upload.
diff -Nru opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat-2.patch opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat-2.patch
--- opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat-2.patch 1970-01-01 01:00:00.000000000 +0100
+++ opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat-2.patch 2025-12-18 09:48:20.000000000 +0100
@@ -0,0 +1,41 @@
+From 443d0ae63fad6dfd8c485d609203db16c8bd0ec3 Mon Sep 17 00:00:00 2001
+From: Dmitry Kurtaev <dmitry.kurtaev at gmail.com>
+Date: Mon, 8 Sep 2025 08:52:56 +0300
+Subject: [PATCH] Merge pull request #27746 from
+ dkurt:d.kurtaev/av_packet_side_data_get
+
+fix: FFmpeg 8.0 support #27746
+
+### Pull Request Readiness Checklist
+
+related comment: https://github.com/opencv/opencv/pull/27691#discussion_r2322695640
+
+See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
+
+- [x] I agree to contribute to the project under Apache 2 License.
+- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
+- [x] The PR is proposed to the proper branch
+- [x] There is a reference to the original bug report and related work
+- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
+ Patch to opencv_extra has the same branch name.
+- [x] The feature is well documented and sample code can be built with the project CMake
+---
+ modules/videoio/src/cap_ffmpeg_impl.hpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
+index 5780b4c11361..d971ca75b320 100644
+--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
++++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
+@@ -2017,7 +2017,10 @@ void CvCapture_FFMPEG::get_rotation_angle()
+ if (sd && nb_sd > 0)
+ {
+ const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX);
+- data = mtx->data;
++ if (mtx)
++ {
++ data = mtx->data;
++ }
+ }
+ # endif
+ if (data)
diff -Nru opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat.patch opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat.patch
--- opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat.patch 1970-01-01 01:00:00.000000000 +0100
+++ opencv-4.10.0+dfsg/debian/patches/ffmpeg-8.0-compat.patch 2025-12-18 09:46:36.000000000 +0100
@@ -0,0 +1,43 @@
+From 90c444abd387ffa70b2e72a34922903a2f0f4f5a Mon Sep 17 00:00:00 2001
+From: Alexander Smorkalov <alexander.smorkalov at opencv.ai>
+Date: Wed, 20 Aug 2025 10:53:51 +0300
+Subject: [PATCH] FFmpeg 8.0 support.
+
+---
+ modules/videoio/src/cap_ffmpeg_impl.hpp | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp
+index 489dbe565d3d..5780b4c11361 100644
+--- a/modules/videoio/src/cap_ffmpeg_impl.hpp
++++ b/modules/videoio/src/cap_ffmpeg_impl.hpp
+@@ -685,7 +685,10 @@ void CvCapture_FFMPEG::close()
+ if( video_st )
+ {
+ #ifdef CV_FFMPEG_CODECPAR
++// avcodec_close removed in FFmpeg release 8.0
++# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
+ avcodec_close( context );
++# endif
+ #endif
+ video_st = NULL;
+ }
+@@ -2005,7 +2008,18 @@ void CvCapture_FFMPEG::get_rotation_angle()
+ rotation_angle = 0;
+ #if LIBAVFORMAT_BUILD >= CALC_FFMPEG_VERSION(57, 68, 100)
+ const uint8_t *data = 0;
++ // av_stream_get_side_data removed in FFmpeg release 8.0
++# if (LIBAVCODEC_BUILD < CALC_FFMPEG_VERSION(62, 11, 100))
+ data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
++# else
++ AVPacketSideData* sd = video_st->codecpar->coded_side_data;
++ int nb_sd = video_st->codecpar->nb_coded_side_data;
++ if (sd && nb_sd > 0)
++ {
++ const AVPacketSideData* mtx = av_packet_side_data_get(sd, nb_sd, AV_PKT_DATA_DISPLAYMATRIX);
++ data = mtx->data;
++ }
++# endif
+ if (data)
+ {
+ rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));
diff -Nru opencv-4.10.0+dfsg/debian/patches/series opencv-4.10.0+dfsg/debian/patches/series
--- opencv-4.10.0+dfsg/debian/patches/series 2025-09-27 14:00:00.000000000 +0200
+++ opencv-4.10.0+dfsg/debian/patches/series 2025-12-18 09:48:32.000000000 +0100
@@ -7,3 +7,5 @@
setup-py-for-egg.patch
fix-vsx-build-with-gcc-15.patch
cmake-4.patch
+ffmpeg-8.0-compat.patch
+ffmpeg-8.0-compat-2.patch
More information about the debian-science-maintainers
mailing list