diff --git a/modules/videoio/src/cap_ffmpeg_impl.hpp b/modules/videoio/src/cap_ffmpeg_impl.hpp index b7fa0b745c..98913ed839 100644 --- a/modules/videoio/src/cap_ffmpeg_impl.hpp +++ b/modules/videoio/src/cap_ffmpeg_impl.hpp @@ -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; } diff --git a/modules/videoio/test/test_ffmpeg.cpp b/modules/videoio/test/test_ffmpeg.cpp index 40ef586fd6..115705760c 100644 --- a/modules/videoio/test/test_ffmpeg.cpp +++ b/modules/videoio/test/test_ffmpeg.cpp @@ -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");