-
-
Notifications
You must be signed in to change notification settings - Fork 54
/
docker_run.sh
executable file
·50 lines (41 loc) · 1.11 KB
/
docker_run.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
#!/usr/bin/env bash
#
# Helper script to run Docker container
py_usage() {
docker run \
-t ffmpeg-quality-metrics:latest \
python3 -m ffmpeg_quality_metrics -h
}
usage() {
echo "Usage: $0 <dist> <ref> [OPTIONS]"
echo
echo " <dist> -- distorted video"
echo " <ref> -- reference video"
echo " [OPTIONS] -- further options passed to ffmpeg_quality_metrics.py, see below"
echo
py_usage
exit 1
}
if [ $# -lt 2 ]; then
usage
fi
distFile="$1"
refFile="$2"
distFileBasename="$(basename $1)"
refFileBasename="$(basename $2)"
distDir="$(realpath "$(dirname "$1")")"
refDir="$(realpath "$(dirname "$2")")"
shift; shift
if ! docker image inspect ffmpeg-quality-metrics:latest > /dev/null 2>&1; then
echo "Image 'ffmpeg-quality-metrics:latest' not found, building it first ..."
docker build -t ffmpeg-quality-metrics:latest .
fi
docker run \
--rm \
-v "$distDir":"/tmp/dist" \
-v "$refDir":"/tmp/ref" \
-t ffmpeg-quality-metrics:latest \
python3 -m ffmpeg_quality_metrics \
"/tmp/dist/$distFileBasename" \
"/tmp/ref/$refFileBasename" \
"$@"