senko/python-video-converter

Thumbnail rotation issue

inabhi9 opened this issue · 0 comments

When video is recorded from iPhone, it has some metadata information of orientation. While creating the thumbnail from ffmpeg it doesn't take that into the consideration and creates thumbnail of different orientation.

It would be great if you read that orientation in thumbnail() and pass the rotating argument to ffmpeg accordingly

May be this snippet should work under thumbnails()

        probe = self.probe(fname)
        rotation = 0
        for stream in probe.streams:
            if stream.type == 'video' and stream.metadata.get('rotate'):
                rotation = int(stream.metadata.get('rotate'))
                break
        if rotation == 180:
            cmds.extend(["-vf", "vflip,hflip"])
        elif rotation == 90:
            cmds.extend(["-vf", "transpose=1"])
        elif rotation == 270 or rotation == -90:
            cmds.extend(["-vf", "transpose=2"])