norfair icon indicating copy to clipboard operation
norfair copied to clipboard

MOV video output is flipped verticaly

Open diegomarvid opened this issue 3 years ago • 2 comments
trafficstars

I recorded a video using an iPhone in MOV format and the output was flipped vertically.

The minimum code to reproduce the error is the following:

from norfair import Video

video = Video(input_path='demo.mov')

for frame in video:
    video.write(frame)

The information in the video is the following:

image

diegomarvid avatar Sep 22 '22 14:09 diegomarvid

Does it happen consistently with every MOV video whether it's filmed vertically or horizontally?

dekked avatar Sep 22 '22 15:09 dekked

Only when it's filmed vertically

diegomarvid avatar Sep 22 '22 19:09 diegomarvid

After some research, this is a problem of OpenCV.

The video in question has a tag displaymatrix: rotation of -90.00 degrees (use ffprobe to see the tags) which means that the original video is horizontal and this tag tells you should rotate it but.. OpenCV rotates it in the wrong direction so it ends up flipped.

The problem is already fixed in this PR merged on Jun 13th but the last release is from the 7th.

We just need to upgrade to the latest version of OpenCV once that's released

javiber avatar Sep 30 '22 20:09 javiber