1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

videoio: fix FFmpeg VideoCapture rejecting CAP_PROP_FORMAT=CV_8UC3

This commit is contained in:
Andrew Yooeun Chun
2026-04-09 22:03:14 +09:00
parent 9eb887d02d
commit 570e32cc9b
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -1105,7 +1105,7 @@ bool CvCapture_FFMPEG::open(const char* _filename, int index, const Ptr<IStreamR
{
enableAlpha = false;
}
if (value == CV_8UC4)
else if (value == CV_8UC4)
{
enableAlpha = true;
}
+16
View File
@@ -845,6 +845,22 @@ TEST(videoio_ffmpeg, create_with_property_badarg)
EXPECT_FALSE(cap.isOpened());
}
TEST(videoio_ffmpeg, open_with_format_cv8uc3)
{
if (!videoio_registry::hasBackend(CAP_FFMPEG))
throw SkipTestException("FFmpeg backend was not found");
string video_file = findDataFile("video/big_buck_bunny.mp4");
VideoCapture cap(video_file, CAP_FFMPEG, {
CAP_PROP_FORMAT, CV_8UC3
});
ASSERT_TRUE(cap.isOpened());
EXPECT_EQ(cap.get(CAP_PROP_FORMAT), CV_8UC3);
Mat frame;
ASSERT_TRUE(cap.read(frame));
EXPECT_EQ(frame.channels(), 3);
}
// related issue: https://github.com/opencv/opencv/issues/16821
TEST(videoio_ffmpeg, DISABLED_open_from_web)
{