-
Notifications
You must be signed in to change notification settings - Fork 27
/
mmtest
executable file
·112 lines (104 loc) · 5.65 KB
/
mmtest
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
#!/bin/bash
# mmtest, regression test for edits to "make" scripts
# does not test dvd derivatives or DVD-specific options; iso file checksums cannot match consistently
VERSION="1.0"
SCRIPTDIR=$(dirname $(which "${0}"))
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ;};
DEPENDENCIES=(ffmpeg ffprobe)
_initialize_make
# expected checksums values - last updated 11/01/17 10:30 AM
FIXITY_TABLE="youtube/sample1.mp4,daddcda3c254f47fb8574593e039d49b
youtube/sample2.mp4,55a4c1af304ef6dde3654a7f6787cac1
youtube/sample3.mp4,ee32b13478c444b1db1f0f9bffeac85a
youtube/sample4.mp4,72894c083e33102df9a5d59910ff4aec
broadcast/sample1_SLATE.mov,7f9d5acea14b420790eb7a394b88bec6
broadcast/sample2_SLATE.mov,873c06b9b7b276b885b62fe40f7abc5a
broadcast/sample3_SLATE.mov,78fde441a7d6351030ccbc68cd29ff4b
broadcast/sample4_SLATE.mov,e1b37d30d1c1fcbf6d89059cecae5530
prores/sample1.mov,71e37fce1d20b656e38f9fecaa7edd81
prores/sample2.mov,d0b25fb25a726f2e6ef1754a16c0f213
prores/sample3.mov,8c218fadc3e2dfdd203898ee77203d24
prores/sample4.mov,809e04823b78fe35eb43a535e0f357d9
resourcespace/sample1.mp4,6e4356cd53d51da65a5b3321e6596daf
resourcespace/sample2.mp4,d1a0dd31d1b6c89788a3fa2cda25028b
resourcespace/sample3.mp4,cc311e4b56ac247c2a7de3edf3b2ffeb
resourcespace/sample4.mp4,9124e05edc8167b203a90c8a92541748
mp3/sample1.mp3,00cee68ae656845a1738dd03593715ba
mp3/sample2.mp3,e883cc300b183378c1f111bbb720e73c
mp3/sample3.mp3,904544749ed92f670f5e7119968899fe
mp3/sample4.mp3,6f03e9a204ef540f0cc3d6f541b872e1
pod/sample1_podcast.mov,2c80a4682bc429db5913e8be2e51f4e5
pod/sample2_podcast.mov,12a574b58936fb058913e17f0010595b
pod/sample3_podcast.mov,063d1b113eee3acece7355f8d49c825c
pod/sample4_podcast.mov,945b4762beb1951ec3d7e2669368065e"
# make test folders
ROOTDIR="/tmp/testmakederiv$(date +%Y%m%d%H%M%S)"
TESTDIR="$ROOTDIR/test"
YT_TESTDIR="$ROOTDIR/youtube"
BR_TESTDIR="$ROOTDIR/broadcast"
PR_TESTDIR="$ROOTDIR/prores"
RS_TESTDIR="$ROOTDIR/resourcespace"
MP3_TESTDIR="$ROOTDIR/mp3"
POD_TESTDIR="$ROOTDIR/pod"
LOGDIR="$BR_TESTDIR/logs/broadcast"
mkdir -p "$ROOTDIR" "${TESTDIR}" "${YT_TESTDIR}" "${BR_TESTDIR}" "${PR_TESTDIR}" "${RS_TESTDIR}" "${MP3_TESTDIR}" "${POD_TESTDIR}" "${LOGDIR}"
# create test files
ffmpeg -f lavfi -i testsrc2=r=25:s=320x240 -f lavfi -i "aevalsrc=exprs=sin(440*2*PI*t)|sin(44*2*PI*t):s=48000:c=stereo" -map 0 -map 1 -t 5 -c:v ffv1 -c:a flac -y "$TESTDIR/sample1.nut"
ffmpeg -f lavfi -i testsrc2=r=30000/1001:s=1920x1080 -f lavfi -i "aevalsrc=exprs=cos(440*2*PI*t)|sin(44*2*PI*t):s=48000:c=stereo" -map 0 -map 1 -t 5 -c:v ffv1 -c:a flac -y "$TESTDIR/sample2.nut"
ffmpeg -f lavfi -i mandelbrot=r=25:s=320x240 -f lavfi -i "aevalsrc=exprs=sin(440*2*PI*t)|cos(44*2*PI*t):s=48000:c=stereo" -map 0 -map 1 -t 5 -c:v ffv1 -c:a flac -y "$TESTDIR/sample3.nut"
ffmpeg -f lavfi -i testsrc=r=25:s=720x480 -f lavfi -i "aevalsrc=exprs=cos(440*2*PI*t)|cos(44*2*PI*t):s=48000:c=stereo" -map 0 -map 1 -t 5 -c:v ffv1 -c:a flac -y "$TESTDIR/sample4.nut"
# set slate options
INGESTLOG="$LOGDIR/capture.log" ; touch "$INGESTLOG"
_writeingestlog "media ID slate" "mediaID"
_writeingestlog "Series Title" "Series Title"
_writeingestlog "Episode Title" "Episode Title"
# run checksum tests
_checksumreport(){
ACTUAL_CHECKSUM=$(md5 -q "$OUTPUT")
EXPECTED_CHECKSUM=$(echo "${FIXITY_TABLE}" | grep "$OUTPUT_RELATIVE_PATH" | cut -d , -f 2)
if [[ $ACTUAL_CHECKSUM == $EXPECTED_CHECKSUM ]] ; then
_report -dt "Checksum match."
else
_report -wt "Checksums do not match."
_report -w "Checksum expected: $EXPECTED_CHECKSUM"
_report -w "Checksum generated: $ACTUAL_CHECKSUM"
FAILEDCHECKSUMS+="$OUTPUT_RELATIVE_PATH "
fi
}
find "$TESTDIR" -type f ! -name '.*' > /tmp/list.txt
for file in `cat /tmp/list.txt` ; do
"${SCRIPTDIR}/makederiv" -T youtube -Y -l -o "${YT_TESTDIR}" "$file"
OUTPUT="${YT_TESTDIR}/$(basename "${file%.*}.mp4")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
"${SCRIPTDIR}/makederiv" -T broadcast -F tff -s -c -o "${BR_TESTDIR}" "$file"
OUTPUT="${BR_TESTDIR}/$(basename "${file%.*}_SLATE.mov")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
"${SCRIPTDIR}/makederiv" -T prores -o "${PR_TESTDIR}" "$file"
OUTPUT="${PR_TESTDIR}/$(basename "${file%.*}.mov")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
"${SCRIPTDIR}/makederiv" -T resourcespace -v Y -o "${RS_TESTDIR}" -d "$ROOTDIR" -e "${EMAILADDRESS_DELIVERY}" "$file"
OUTPUT="${RS_TESTDIR}/$(basename "${file%.*}.mp4")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
"${SCRIPTDIR}/makederiv" -T mp3 -o "${MP3_TESTDIR}" "$file"
OUTPUT="${MP3_TESTDIR}/$(basename "${file%.*}.mp3")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
"${SCRIPTDIR}/makederiv" -T podcast -o "${POD_TESTDIR}" -E "${EMAILADDRESS_OUTCOME}" "$file"
OUTPUT="${POD_TESTDIR}/$(basename "${file%.*}_podcast.mov")"
OUTPUT_RELATIVE_PATH=$(echo "${OUTPUT}" | sed "s:${ROOTDIR}/::g")
_checksumreport
done
if [[ -z "$FAILEDCHECKSUMS" ]] ; then
_report -dt "All checksums match."
else
_report -wt "Checksums did not match for the following derivative files:"
_report -w "$FAILEDCHECKSUMS"
fi
echo "This regression test was built on FFmpeg version 3.4 and may return mismatches when used with other versions. You are running FFmpeg version $(ffmpeg -version | grep "ffmpeg version" | awk '{print $3}')."
# delete all test files after 10 minutes
echo "mmtest will delete test files from /tmp in 5 minutes; press control-C to keep files in /tmp folder."
sleep 300 && rm -r "${ROOTDIR}"