senko / python-video-converter

Python Video Converter (ffmpeg wrapper)
468 stars 191 forks source link

Thumbnail rotation issue #51

Open inabhi9 opened 9 years ago

inabhi9 commented 9 years ago

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"])