-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.sh
86 lines (59 loc) · 1.91 KB
/
test.sh
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
#!/bin/bash
# This simple test generates a silent 60s 720p test video and streams it with ffserver.
# At the time of writing incorrect timestamps prevent HLS from working properly and
# something else is preventing DASH from working properly. However the matroska test
# should succeed.
# The tests need ffserver to be compiled and ffmpeg and curl to be present.
# generate source
ffmpeg -re -f lavfi -i testsrc2=s=1280x720:r=30 -f lavfi -i anullsrc=r=48000 -g 60 -c:v libx264 -c:a aac -pix_fmt yuv420p -t 60 -y orig.mkv -g 60 -c:v libx264 -c:a aac -pix_fmt yuv420p -t 60 -listen 1 -f matroska http://127.0.0.1:8080 2> source.log &
ffmpeg_pid=$!
sleep 1
# start server
./ffserver test_config.lua 2> ffserver.log &
ffserver_pid=$!
sleep 2
ffmpeg -i http://127.0.0.1:8081/test/mkv -y -c copy mkv.mkv 2> mkv.log &
ffmpeg_mkv_pid=$!
sleep 1
curl http://127.0.0.1:8081/test/mkv > curl_mkv.mkv 2> curl_mkv.log &
curl_mkv_pid=$!
#ffmpeg -i http://127.0.0.1:8081/test/hls -y -c copy hls.mkv 2> hls.log &
#ffmpeg_hls_pid=$!
#ffmpeg -i http://127.0.0.1:8081/test/dash -y -c copy dash.mkv 2> dash.log &
#ffmpeg_dash_pid=$!
wait $ffmpeg_pid
echo source quit
wait $ffmpeg_mkv_pid
echo mkv quit
wait $curl_mkv_pid
echo curl mkv quit
#wait $ffmpeg_hls_pid
#echo hls quit
#wait $ffmpeg_dash_pid
#echo dash quit
wait $ffserver_pid
echo ffserver quit
md5sum orig.mkv mkv.mkv curl_mkv.mkv
rm -rf test/
ffmpeg -i orig.mkv -f framecrc -y orig.crc
ffmpeg -i mkv.mkv -f framecrc -y mkv.crc
ffmpeg -i curl_mkv.mkv -f framecrc -y curl_mkv.crc
echo Diffs:
fail=0
diff orig.crc mkv.crc
if [[ $? -ne "0" ]]
then
echo orig.mkv differs from mkv.mkv
fail=1
fi
diff orig.crc curl_mkv.crc
if [[ $? -ne "0" ]]
then
echo orig.mkv differs from curl_mkv.mkv
fail=1
fi
if [[ $fail -eq "0" ]]
then
echo Test passed, files are the same.
fi
rm orig.mkv orig.crc mkv.mkv mkv.crc curl_mkv.mkv curl_mkv.crc source.log ffserver.log mkv.log curl_mkv.log