====== framecount ======
* [[frameinfo]]
Display number of frames in a video and part of their types:
for x in $*; do
echo -n "$x: "
tmp=`tempfile`
ffmpeg -i "$x" -vf showinfo -f null /dev/null 2>&1 | cut -d ' ' -f 4- | grep ^n > $tmp
ffmpeg -fflags +genpts -i "$x" -an -sn -vf showinfo -f null - 2>&1 | egrep 'i:(P|T|B)' > "$tmp"
num_p=`grep -c i:P "$tmp"`
num_t=`grep -c i:T "$tmp"`
num_b=`grep -c i:B "$tmp"`
echo "progressive: $num_p top-field: $num_t bottom-field: $num_b"
rm $tmp
done
Example:
$ framecount 1.722.2330.18435.TMNT2.mpg
1.722.2330.18435.TMNT2.mpg: progressive: 32599 top-field: 0 bottom-field: 0