

FFmpeg is a versatile multimedia framework that allows us to make various different operations with video files.

Making the video fullscreen and then turn it back will usually set the correct video aspect. And finally, here’s a command to rotate the video clip to the 90 degrease clockwise (use transpose2 to rotate to anti clockwise direction): ffmpeg -i sample-mp4-file.mp4 -hidebanner -filter:v transpose1 OutputVideo.mp4. It has the same problem as ffmpeg: it does not know the new aspect and you will need to set it manually. The ffmpeg command will be like: ffmpeg -i in.mov -vf "transpose=1" -s 540x960 -strict -2 out.movīonus: MPlayer can also rotate the video during playing: mplayer -vf-add rotate=1 in.mov It may be quite large and usually can be reduced to some smaller one like “540×960” respectively if you like. It will print out the aspect of the video like: VIDEO: 1920x1080 24bpp 29.91.4 kbps (2630.8 kbyte/s)Īfter it is rotated, it should be “1080×1920”. Now, the problem is how to get the video aspect. To solve the problems, we can do it by one single shot: setting the aspect during rotating the video by specifying -s to ffmpeg. However, this can work but still has problems: 1) the video aspects are wrong.

To rotate 90 clockwise, we will choose “1” like: ffmpeg -i in.mov -vf "transpose=1" -strict -2 out.mov The tool we choose to use is ffmpeg which can rotate video with video filters.įfmpeg supports several “transpositions”: 0 = 90CounterCLockwise and Vertical Flip (default)
