Skip to content

Instantly share code, notes, and snippets.

@tillig
Created January 13, 2018 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tillig/7e4f83e08f4eb6ba75485d745dce5b79 to your computer and use it in GitHub Desktop.
Save tillig/7e4f83e08f4eb6ba75485d745dce5b79 to your computer and use it in GitHub Desktop.
Rotate Video with FFmpeg

Values for the transpose parameter:

  • 0 = 90 counter-clockwise and vertical flip (default)
  • 1 = 90 clockwise
  • 2 = 90 counter-clockwise
  • 3 = 90 clockwise and vertical flip

To rotate 180 degrees, use "transpose=2,transpose=2"

Using -codec:a copy will simply copy the audio instead of reencoding it.

ffmpeg -i in.mp4 -vf "transpose=1" -codec:a copy out.mp4

A more complex variation re-encodes both the audio and video but I could only get it to work with the FFmpeg that comes with WinFF 1.4.2. I think some of the options here got deprecated.

ffmpeg.exe -y -i in.mp4 -crf 15.0 -vcodec libxvid -acodec libfaac -ar 48000 -b:a 192k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 0 -qmax 69 -qdiff 4 -bf 8 -refs 16 -direct-pred 3 -trellis 2 -wpredp 2 -rc_lookahead 60 -threads 0 -b 12000k -vf transpose=1 out.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment