|
|
|
@ -480,18 +480,34 @@ void CV_HighGuiTest::SpecificVideoTest(const string& dir, const cvtest::VideoFor |
|
|
|
|
|
|
|
|
|
size_t FRAME_COUNT = (size_t)cap.get(CV_CAP_PROP_FRAME_COUNT); |
|
|
|
|
|
|
|
|
|
if (FRAME_COUNT != IMAGE_COUNT ) |
|
|
|
|
size_t allowed_extra_frames = 0; |
|
|
|
|
|
|
|
|
|
// Hack! Newer FFmpeg versions in this combination produce a file
|
|
|
|
|
// whose reported duration is one frame longer than needed, and so
|
|
|
|
|
// the calculated frame count is also off by one. Ideally, we'd want
|
|
|
|
|
// to fix both writing (to produce the correct duration) and reading
|
|
|
|
|
// (to correctly report frame count for such files), but I don't know
|
|
|
|
|
// how to do either, so this is a workaround for now.
|
|
|
|
|
// See also the same hack in CV_PositioningTest::run.
|
|
|
|
|
if (fourcc == CV_FOURCC('M', 'P', 'E', 'G') && ext == "mkv") |
|
|
|
|
allowed_extra_frames = 1; |
|
|
|
|
|
|
|
|
|
if (FRAME_COUNT < IMAGE_COUNT || FRAME_COUNT > IMAGE_COUNT + allowed_extra_frames) |
|
|
|
|
{ |
|
|
|
|
ts->printf(ts->LOG, "\nFrame count checking for video_%s.%s...\n", fourcc_str.c_str(), ext.c_str()); |
|
|
|
|
ts->printf(ts->LOG, "Video codec: %s\n", fourcc_str.c_str()); |
|
|
|
|
ts->printf(ts->LOG, "Required frame count: %d; Returned frame count: %d\n", IMAGE_COUNT, FRAME_COUNT); |
|
|
|
|
if (allowed_extra_frames != 0) |
|
|
|
|
ts->printf(ts->LOG, "Required frame count: %d-%d; Returned frame count: %d\n", |
|
|
|
|
IMAGE_COUNT, IMAGE_COUNT + allowed_extra_frames, FRAME_COUNT); |
|
|
|
|
else |
|
|
|
|
ts->printf(ts->LOG, "Required frame count: %d; Returned frame count: %d\n", IMAGE_COUNT, FRAME_COUNT); |
|
|
|
|
ts->printf(ts->LOG, "Error: Incorrect frame count in the video.\n"); |
|
|
|
|
ts->printf(ts->LOG, "Continue checking...\n"); |
|
|
|
|
ts->set_failed_test_info(ts->FAIL_BAD_ACCURACY); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; (size_t)i < FRAME_COUNT; i++) |
|
|
|
|
for (int i = 0; (size_t)i < IMAGE_COUNT; i++) |
|
|
|
|
{ |
|
|
|
|
Mat frame; cap >> frame; |
|
|
|
|
if (frame.empty()) |
|
|
|
|