From c309fe76d4b53258ff4165ba70526db7aa17819d Mon Sep 17 00:00:00 2001 From: Karnajeet Gosavi Date: Tue, 24 Nov 2026 09:22:10 +0530 Subject: [PATCH] Merge pull request #31029 from kg290/codex/ffmpeg-frame-size-warning videoio: Report expected and actual FFmpeg frame sizes --- modules/videoio/src/cap_ffmpeg_impl.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index d2640a2485..0b29a9fc0f 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -2953,7 +2953,13 @@ bool CvVideoWriter_FFMPEG::writeFrame( const unsigned char* data, int step, int CV_Assert(false); } - if( (width & -2) != frame_width || (height & -2) != frame_height || !data ) + if ((width & -2) != frame_width || (height & -2) != frame_height) + { + CV_LOG_WARNING(NULL, "write frame failed - expected frame size " << frame_width << "x" << frame_height + << " but got " << width << "x" << height); + return false; + } + if (!data) return false; width = frame_width; height = frame_height;