Skip to content

Videos with orientation metadata rotated in the opposite direction #22088

@tailsu

Description

@tailsu
System information (version)
  • OpenCV => 4.6.0
  • Operating System / Platform => Mac, Linux, WIndows
  • Compiler => clang 13

OpenCV built from source, tag 4.6.0.

FFmpeg version on Windows:

FFMPEG: Downloading opencv_videoio_ffmpeg.dll from https://raw.githubusercontent.com/opencv/opencv_3rdparty/65ec04d4573dcdfa4531f0b9e67f35d8ffff873e/ffmpeg/opencv_videoio_ffmpeg.dll
Detailed description

4.6.0 rotates videos with orientation metadata in the opposite direction compared to 4.5.5. As a result videos that have a +/- 90 deg rotation are displayed upside-down. For now, the workaround is to disable auto-rotation, read out CAP_PROP_ORIENTATION_META and manually apply the rotation in the correct direction.

Steps to reproduce

Tested with the video file from opencv/opencv_extra#765

Test code

    cv::VideoCapture input("big_buck_bunny_rotated.mp4");
    auto orient = input.get(cv::CAP_PROP_ORIENTATION_META);

In OpenCV 4.5.5 orient is 90, which is correct. in OpenCV 4.6.0 orient is 270, which is a regression.

Since the code that implements CAP_PROP_ORIENTATION_AUTO relies on the orientation value from the video metadata, you get an upside-down result.

Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions