-
Notifications
You must be signed in to change notification settings - Fork 27
/
qatesting
executable file
·135 lines (113 loc) · 5.84 KB
/
qatesting
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
#this script performs a series of quality assurance tests on an audio visual file or set of files
SCRIPTDIR=$(dirname $(which "${0}"))
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ;};
while [ "${*}" != "" ] ; do
INPUT="${1}"
shift
MEDIAID=$(_readingestlog "media ID")
if [[ ! "${MEDIAID}" ]] ; then
MEDIAID=$(basename "${INPUT}" | cut -d. -f1)
fi
#reports out information
_black_at_ends "${INPUT}"
#modified original function to report only
_get_frame_count(){
INPUT_MOVIE="${1}"
CONTAINERFRAMECOUNT=$(mediainfo --inform="Video;%FrameCount%" "${INPUT_MOVIE}")
_report -dt "The frame count according to the container is: ${CONTAINERFRAMECOUNT}"
VIDEOTRACKFRAMECOUNT=$(mediainfo --inform="Video;%Source_FrameCount%" "${INPUT_MOVIE}")
_report -dt "The frame count according to the video track is: ${VIDEOTRACKFRAMECOUNT}"
if [ ! -z "${VIDEOTRACKFRAMECOUNT}" ] ; then
if [ "${VIDEOTRACKFRAMECOUNT}" -ne "${CONTAINERFRAMECOUNT}" ] ; then
_report -wt "warning - there are discrepancies between the container frame count and video track frame count. This could result in the desynchronization of audio and video."
fi
fi
}
_get_frame_count "${INPUT}"
_get_prettyduration "${INPUT}"
echo "The duration of ${MEDIAID} in HH:mm:ss is: ${PRETTYDURATION}"
_get_duration "${INPUT}"
echo "The duration of ${MEDIAID} in mm.sssss is: ${DURATION}"
_get_broadcastduration "${INPUT}"
echo "The duration of ${MEDIAID} in HH:mm;ss is: ${BROADCASTDURATION}"
_get_seconds "${INPUT}"
echo "The seconds in ${MEDIAID} are: ${FILESECONDS}"
_get_width "${INPUT}"
echo "The width of ${MEDIAID} is: ${WIDTH}"
_get_height "${INPUT}"
echo "The height of ${MEDIAID} is: ${HEIGHT}"
_get_dar "${INPUT}"
echo "The display aspect ratio of ${MEDIAID} is: ${DAR}"
_get_sar "${INPUT}"
echo "The sample aspect ration of ${MEDIAID} is: ${SAR}"
_get_audio_index "${INPUT}"
echo "The index value of the first audio stream is: ${AUDIO_INDEX_1}"
echo "The index value of the second audio stream is: ${AUDIO_INDEX_2}"
_get_audio_channels "${INPUT}"
echo "The number of audio channels in ${MEDIAID} is: ${AUDIO_CHANNELS}"
_get_pix_fmt "${INPUT}"
echo "The pixel order of ${MEDIAID} is: ${PIXFMT}"
_get_videostreamcount "${INPUT}"
echo "The video stream count of ${MEDIAID} is: ${VIDEOSTREAMCOUNT}"
_get_audiostreamcount "${INPUT}"
echo "The audio stream count of ${MEDIAID} is: ${AUDIOSTREAMCOUNT}"
_get_timecode "${INPUT}"
if [ -z "${TIMECODE}" ] ; then
echo "There is no time code associated with this file."
else
echo "The timecode of ${MEDIAID} is: ${TIMECODE}"
fi
#function modified for script
_get_volume_adjustment(){
REFERENCE=-24
INTEGRATED_LOUDNESS=""
LOUDNESS_RANGE=""
VOLDET_MEAN_VOLUME=""
VOLDET_MAX_VOLUME=""
VOLADJ=""
INPUT_MOVIE="${1}"
_report -dt "Getting volume data for $(basename "${INPUT_MOVIE}") ..."
VOLDETTEMP=$(_maketemp)
VOLUME_DATA=$(ffprobe -of compact=p=0:nk=1:s=',' -show_entries frame_tags=lavfi.r128.I,lavfi.r128.LRA -f lavfi "amovie='${INPUT_MOVIE}',ebur128=metadata=1,volumedetect" 2>"${VOLDETTEMP}" | grep -v "^$" | tail -n1)
VOLUME_EXIT_CODE="${?}"
if [ "${VOLUME_EXIT_CODE}" -ne 0 ] ; then
_report -wt "Volume analysis for ${INPUT_MOVIE} exited with ${VOLUME_EXIT_CODE}."
else
AUDIOFRAME_I=$(echo "${VOLUME_DATA}" | cut -d, -f1)
AUDIOFRAME_LRA=$(echo "${VOLUME_DATA}" | cut -d, -f2)
[ "${AUDIOFRAME_I}" != "" ] && INTEGRATED_LOUDNESS="${AUDIOFRAME_I}"
[ "${AUDIOFRAME_LRA}" != "" ] && LOUDNESS_RANGE="${AUDIOFRAME_LRA}"
VOLDET_MEAN_VOLUME=$(grep "mean_volume" "${VOLDETTEMP}" | cut -d: -f 2 | awk '{print $1}')
VOLDET_MAX_VOLUME=$(grep "max_volume" "${VOLDETTEMP}" | cut -d: -f 2 | awk '{print $1}')
VOLADJ=$(echo "${REFERENCE} - ${INTEGRATED_LOUDNESS}" | bc)
# test to see if adjustment is at least 2dB, else skip
_report -dt "Loudness range is ${LOUDNESS_RANGE}dB."
echo "audio_adjustment is: ${VOLADJ}"
echo "r128_loudness_reference is: ${REFERENCE}"
echo "r128_loudness_range is: ${LOUDNESS_RANGE}"
echo "r128_integrated_loudness is: ${INTEGRATED_LOUDNESS}"
echo "voldet_mean_volume is: ${VOLDET_MEAN_VOLUME}"
echo "voldet_max_volume is: ${VOLDET_MAX_VOLUME}"
fi
}
_get_volume_adjustment "${INPUT}"
#function modified for script
_get_interlacement_full(){
INPUT_MOVIE="${1}"
_get_mediainfo_interlacement(){
CONTAINER_INTERLACEMENT=$(mediainfo --inform="Video;%ScanOrder%" "${INPUT_MOVIE}")
}
IDET_INTERLACEMENT=$(ffmpeg -i "${INPUT_MOVIE}" -vf idet -f null -an - 2>&1 | grep "Multi frame detection:")
IDET_SUMMARY=$(echo "${IDET_INTERLACEMENT}" | cut -d: -f2- | awk '{print $1 " " $2 "\n" $3 " " $4 "\n" $5 " " $6 "\n" $7 " " $8}')
IDET_TOP=$(echo "${IDET_INTERLACEMENT}" | cut -d: -f2- | awk '{print $1 " " $2 "\n" $3 " " $4 "\n" $5 " " $6 "\n" $7 " " $8}' | sort -n -k2 | tail -n1 | cut -d: -f1)
echo "Testing with ffmpeg says this file is ${IDET_TOP}"
_get_mediainfo_interlacement
if [ -z "${CONTAINER_INTERLACEMENT}" ] ; then
_report -qn "MediaInfo can't test the interlacement of this file. Please consider using the results from the ffmpeg file test."
else
echo "Media Info says this file is ${CONTAINER_INTERLACEMENT}"
fi
}
_get_interlacement_full "${INPUT}" #modify based on statements written into function
done