correct direction of displaymatrix rotation

pull/22089/head
Stefan Dragnev 3 years ago
parent dda2e9374b
commit d09bd6f862
  1. 2
      modules/videoio/src/cap_ffmpeg_impl.hpp
  2. 5
      modules/videoio/test/test_ffmpeg.cpp

@ -1840,7 +1840,7 @@ void CvCapture_FFMPEG::get_rotation_angle()
data = av_stream_get_side_data(video_st, AV_PKT_DATA_DISPLAYMATRIX, NULL);
if (data)
{
rotation_angle = cvRound(av_display_rotation_get((const int32_t*)data));
rotation_angle = -cvRound(av_display_rotation_get((const int32_t*)data));
if (rotation_angle < 0)
rotation_angle += 360;
}

@ -413,6 +413,11 @@ TEST(videoio, mp4_orientation_meta_auto)
EXPECT_NO_THROW(cap.open(video_file, CAP_FFMPEG));
ASSERT_TRUE(cap.isOpened()) << "Can't open the video: " << video_file << " with backend " << CAP_FFMPEG << std::endl;
#ifndef _WIN32 // TODO: FFmpeg wrapper update
// related issue: https://github.com/opencv/opencv/issues/22088
EXPECT_EQ(90, cap.get(CAP_PROP_ORIENTATION_META));
#endif
cap.set(CAP_PROP_ORIENTATION_AUTO, true);
if (cap.get(CAP_PROP_ORIENTATION_AUTO) == 0)
throw SkipTestException("FFmpeg frame rotation metadata is not supported");

Loading…
Cancel
Save