Tag Archives: php ffmpeg

FFMPEG Rotating Video – Transpose vs Rotate

FFMpeg can be used to rotate a video or change the video orientation. There are two ways to do that – Transpose and Rotate.

But there is a difference – with Transpose the whole video gets rotated (as is expected to happen) but with Rotate the video gets cropped to fit the existing height of the video and on the sides black border will appear.

ffmpeg -y -i INPUT.mp4 -c:v libx264 -crf 23 -acodec copy -vf "transpose=1" -metadata:s:v rotate=0 -movflags +faststart OUTPUT.mp4

transpose=1 will rotate the video clock-wise by 90 degrees.
ffmpeg -y -i INPUT.mp4 -c:v libx264 -crf 23 -acodec copy -vf "rotate=PI/2" -metadata:s:v rotate=0 -movflags +faststart OUTPUT.mp4

rotate=PI/2 will also rotate the video clock-wise by 90 degrees but the resultant video will get cropped.