Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save robertcedwards/e46e4b551095e138be1e3c50ea016cd0 to your computer and use it in GitHub Desktop.
Save robertcedwards/e46e4b551095e138be1e3c50ea016cd0 to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg
accepted
Rotate 90 clockwise:
ffmpeg -i in.mov -vf "transpose=1" out.mov
For the transpose parameter you can pass:
0 = 90CounterCLockwise and Vertical Flip (default)
1 = 90Clockwise
2 = 90CounterClockwise
3 = 90Clockwise and Vertical Flip
Use -vf "transpose=2,transpose=2" for 180 degrees.
Make sure you use a recent ffmpeg version from here (a static build will work fine).
Note that this will re-encode the audio and video parts. You can usually copy the audio without touching it, by using -c:a copy. To change the video quality, set the bitrate (for example with -b:v 1M) or have a look at the H.264 encoding guide if you want VBR options.
A solution is also to use this convenience script.
shareimprove this answer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment