Tuesday, 28 May 2013

bash shell script for rotating videos 90 degrees clockwise

This is useful when recording videos sideways, something frequently done on smart phones and tablets.

You'll need avconv, which I believe is standard in Ubuntu, as well as the  libavcodec-extra-53 package.

rotate-video-90-degrees:
#!/bin/bash
if [ "$1" = "" ]; then
  echo "Syntax: $0 filename(s)"
  echo "rotates all videos and puts them in a subdirectory named rotated/"
  exit 1
fi

for f in $*
do
echo
echo "*** $f --> rotated/$f ***"
avconv -i $f -c:v libx264 -c:a copy -vf "transpose=1" rotated/$f
done

No comments:

Post a Comment