summaryrefslogtreecommitdiffstats
path: root/tools/video_aspect_ratio
blob: ac81980bdb203cdf554c5534afa2136e50ca1683 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
#
# Date:    2009-12-04
# Author:  Ole Kristian Lien
# License: GNU General Public License
#
# Show the pixel aspect ratio (PAR) for a video-file

EXT=`echo "$1"|awk -F . '{print $NF}'`
PAR=`ffmpeg -i $1 2>&1 | grep Video | cut -d "," -f 5 | cut -d " " -f 3`

if [ -z "$1" ]; then
	echo "Usage: $0 <video-file>"
	exit 1
fi

if [ $EXT == "dv" ] ; then
	if [ "$PAR" == "59:54" ] ; then
		echo "4:3"
	elif [ "$PAR" == "118:81" ] ; then
		echo "16:9"
	else
		echo "Unkown pixel aspect ratio"
	fi
else
	echo "Video format not supported"
	exit 1
fi