-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtranscode.sh
executable file
·28 lines (20 loc) · 963 Bytes
/
transcode.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
#!/bin/bash
echo $1
echo $2
echo "----------Starting encoding-------"
path="/usr/local/nginx/Videos/vod/"
filename=$1
input_file=$path$1
output_file="$2.mp4"
output_filename=$path$output_file
input_name=${filename%.*}
inter="intermediate_${input_name}_2400k.264"
x264 --output $inter --fps 24 --preset slow --bitrate 2400 --vbv-maxrate 4800 --vbv-bufsize 9600 --min-keyint 48 --keyint 48 --scenecut 0 --no-scenecut --pass 1 --video-filter "resize:width=1280,height=720" $input_file
MP4Box -add $inter -fps 24 $output_filename
MP4Box -dash 4000 -frag 4000 -rap -segment-name ${output_file%.*}_segment_ $output_filename
scp ${output_file%.*}_segment* [email protected]:/usr/local/nginx/Videos/vod/
scp ${output_file%.*}_dash.mpd [email protected]:/usr/local/nginx/Videos/vod/
scp ${output_file%.*}_dash.mpd [email protected]:/usr/local/nginx/Videos/vod/
scp ${output_file%.*}_segment* [email protected]:/usr/local/nginx/Videos/vod/
rm $inter
rm x264*