From b48b2d43b068fe00562e1223811f1ac893f0ac8c Mon Sep 17 00:00:00 2001 From: mbarann Date: Thu, 12 Nov 2015 13:13:45 +0100 Subject: [PATCH] MSMF expects a bottom-up video frame, so the buffer pointer must point to the end of the data and the stride needs to be negative --- modules/videoio/src/cap_msmf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/videoio/src/cap_msmf.cpp b/modules/videoio/src/cap_msmf.cpp index 7f4179a816..19f40ca52f 100644 --- a/modules/videoio/src/cap_msmf.cpp +++ b/modules/videoio/src/cap_msmf.cpp @@ -4372,8 +4372,8 @@ HRESULT CvVideoWriter_MSMF::WriteFrame(DWORD *videoFrameBuffer, const LONGLONG& hr = MFCopyImage( pData, // Destination buffer. cbWidth, // Destination stride. - (BYTE*)videoFrameBuffer, // First row in source image. - cbWidth, // Source stride. + ((BYTE*)videoFrameBuffer) + (videoHeight-1)*cbWidth, // First row in source image. + -cbWidth, // Source stride. cbWidth, // Image width in bytes. videoHeight // Image height in pixels. );