Skip to content

Instantly share code, notes, and snippets.

@shrwnsan
Last active January 23, 2017 16:48
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 shrwnsan/a4db057270bd41fdcf30f16177595433 to your computer and use it in GitHub Desktop.
Save shrwnsan/a4db057270bd41fdcf30f16177595433 to your computer and use it in GitHub Desktop.
Batch rotate videos. Note: This will stream copy the bitstreams, so no encoding is performed. Only the metadata of the first video stream (v:0) is changed here and the player will show the video in a rotated way. (Not all players will support this.)
# Works on the latest ffmpeg
# Source, Stackoverflow http://bit.ly/2k960G7
# brew install ffmpeg
# Default for iPhone
ext=m4v
# Set your directory
for f in /some/dir/*.$ext; do
new=${f/%.$ext/-rotated.$ext};
ffmpeg -i "$f" -c copy -metadata:s:v:0 rotate=270 "$new"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment