opencv - video looks good but frames are rotated 90 degrees

前端 未结 2 855
独厮守ぢ
独厮守ぢ 2020-12-19 13:13

We save a video on a mobile client and send it to a server. On the server, I use the following code to save the frames:>

import skvideo.io
import cv2

haar =         


        
2条回答
  •  失恋的感觉
    2020-12-19 13:38

    there was a glitch in skvideo, it was not reading the available metadata. For videos taken in mobile are rotated, but metadata includes such parameter. The skvideo team committed a fix, and current skvideo version 1.1.7 reads metadata from mobile, that indicates that video should be rorated. skvideo.io.vread then rotates the file:

    1) use newer skvideo version, 1.1.7 which can be cloned at https://github.com/scikit-video/scikit-video

    2) You can use following code to read all frames in the video, most likely metadata will be read

    import skvideo.io
    videogen = skvideo.io.vread(f.name)
    

    That will rotate the video automatically if it was taken in portrait mode.

    3) Created an issue on skvideo repo, take a look for further reference: https://github.com/scikit-video/scikit-video/issues/40

提交回复
热议问题