-
Notifications
You must be signed in to change notification settings - Fork 0
/
encode.sh
31 lines (25 loc) · 821 Bytes
/
encode.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
#!/bin/bash
# assumption: full paths are provided
input=$1
output=$2
# assupmtion: x264 and aac are desired
# DVD= 20 +/- 1
# BD= 22 +/- 1
quality=23
preset=veryfast
level=4.1
audiobr=128
# assimption: film, constant framerate, strict-anamorphic
vparams="-e x264 --x264-preset $preset --h264-level $level -q $quality --x264-tune film --cfr --strict-anamorphic"
aparams="-E av_aac -B $audiobr"
# docker needs output to exist to map (?)
touch ${output}
touch ${output}.log
docker run --rm \
-v ${input}:/tmp/${input}:ro \
-v ${output}:/tmp/${output}:rw \
-v ${output}.log:/tmp/${output}.log:rw \
danbo/handbrake \
/bin/bash -c "HandBrakeCLI $vparams $aparams -i \"/tmp/${input}\" -o \"/tmp/${output}\" 2>\"/tmp/${output}.log\""
# update output file date to match input file date
touch -r "$input" "$output"