Ask Your Question

Incorrect Video Orientation

asked 2018-10-30 13:24:37 -0600

Grieverheart gravatar image

I have written some code that uses OpenCV to read frames from a video file and display them using OpenGL. This works fine except for videos taken with my smartphone where the video is rotated by 90 degrees. From my understanding, the orientation info is in the metadata section of the file, but OpenCV doesn't seem to use this information nor does it provide any means of getting that information.

How can I detect the video orientation so that I can correct it? Is my only option using an external tool like e.g. MediaInfo?

edit retag flag offensive close merge delete


opencv in general does not read any meta information (from video or images)

an exception was made for png images.

(but it's somewhat controversial, what exactly should happen in that case ? i'd say an image is an has width and height, and those should exactly mean, what it says, not what a phone thinks it was)

berak gravatar imageberak ( 2018-10-30 13:31:24 -0600 )edit

maybe , you're just expecting the wrong thing here ?

berak gravatar imageberak ( 2018-10-30 13:32:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-02 04:38:55 -0600

Grieverheart gravatar image

I think you might be right. The use of metadata for orientation is, I guess, not the way these video formats were designed. I guess I'll use an external tool to 'correct' such videos before feeding them to my application.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-10-30 13:24:37 -0600

Seen: 2,884 times

Last updated: Oct 30 '18