video orientation detection in bash
ffprobe
is part of the ffmpeg
package and it will report on video metadata.
ffprobe somevideo.mp4
grep
can be used to select just the rotation information. On a rotated video, I see this output:
$ ffprobe somevideo.mp4 2>&1 | grep rotate
rotate : 90
On unrotated videos that I tried, the above command produced no output.
This command depends on video file's metadata. If you have a source that does not produce a reliable rotate
tag, you may need to look for other tags.
Old cameras that do not have accelerometers (gravity sensors) cannot tell if they are held in portrait or landscape orientation and hence cannot produce any useful tag.