Finding the rotation of a iPhone video

Published: Tuesday, Oct 7, 2014 Last modified: Monday, Apr 8, 2024

Using ffprobe which should be included in a ffmpeg distribution:

for m in *.MOV
do
		r=$(ffprobe $m 2>&1 | grep -i rotate | awk '{print $3}')
		case $r in
				90)
						echo Needs to be $m 90 degrees
						;;
				180)
						echo Needs to be $m 180 degrees
						;;
				270)
						echo Needs to be $m 270 degrees
						;;
				*)
						echo No rotating required $m
		esac
done