-
Notifications
You must be signed in to change notification settings - Fork 27
/
makeqctoolsreport
executable file
·56 lines (52 loc) · 1.87 KB
/
makeqctoolsreport
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# qctools reporter
# this bash script accepts one or many video file inputs and produces
# sidecar QCTools xml.gz report file for each input
_get_videostreamcount(){
VIDEOSTREAMCOUNT=$(ffprobe "${1}" -select_streams v -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }')
}
_get_audiostreamcount(){
AUDIOSTREAMCOUNT=$(ffprobe "${1}" -select_streams a -show_entries stream=index -of flat 2>/dev/null | awk 'END { print NR }')
}
while [ "${*}" != "" ] ; do
unset audiofilterseperator
unset moviefiltermap
unset moviefilteroutput
unset ebur128filters
file="${1}"
_get_videostreamcount "${file}"
_get_audiostreamcount "${file}"
if [[ "${VIDEOSTREAMCOUNT}" > 0 ]] ; then
moviefiltermap=":s=v"
moviefilteroutput="[v0]"
if [[ "${AUDIOSTREAMCOUNT}" > 0 ]] ; then
for (( c=1; c<=${AUDIOSTREAMCOUNT}; c++ )) ; do
moviefiltermap+="+a"
moviefilteroutput+="[ai${c}]"
ebur128filters+=";[ai${c}]ebur128=metadata=1[out${c}]"
done
fi
ffprobe -f lavfi \
-i "movie=${file}${moviefiltermap}${moviefilteroutput},\
[v0]signalstats=stat=tout+vrep+brng,\
cropdetect=reset=1,split[a][b];\
[a]field=top[a1];\
[b]field=bottom[b1],[a1][b1]psnr[out0]\
${ebur128filters}" \
-show_frames \
-show_versions \
-of xml=x=1:q=1 \
-noprivate | gzip > "${file}.qctools.xml.gz"
echo
echo "movie=${file}${moviefiltermap}${moviefilteroutput},\
[v0]signalstats=stat=tout+vrep+brng,\
cropdetect=reset=1,split[a][b];\
[a]field=top[a1];\
[b]field=bottom[b1],[a1][b1]psnr[out0]\
${ebur128filters}"
echo
else
echo "Error: $(basename '"${file}"' does not appear to have a video track, skipping.)"
fi
shift
done