Created
August 19, 2016 13:05
-
-
Save fitz123/745363a14de6abd4d91e56ede71ea5eb to your computer and use it in GitHub Desktop.
Job transcoding task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SRV_PORT=9006 | |
CH_NAME=ch7 | |
SRC="udp://@224.2.2.2:1006?fifo_size=1000000&overrun_nonfatal=1" | |
### | |
# use 2 CPUs and 1024 RAM for 720p | |
# use 1 CPU and 512 RAM for 480p | |
CONSUL=localhost:8500 | |
CH_RES=720 | |
CH_BAND=1800 | |
CPU_RES=2 | |
MEM_RES=1024 | |
## DO not change chunk and playlist sizes, because: | |
# * cleaning task uses these values | |
# * workdir size need to be adjusted | |
# * origin-proxy size and store period rely on it | |
# * iframe calc need to be changed | |
## DO not change preset without changing CPU_RES, | |
# it could lead to laggy stream and insufficient resources | |
## Better DO NOT TOUCH anything under this line at all | |
################################################# | |
# transcoder and origin | |
docker -H :4000 run -d \ | |
--name=origin-$CH_NAME-$CH_RES-$SRV_PORT \ | |
--restart unless-stopped \ | |
--network host \ | |
--tmpfs /tmp/workdir:size="`echo "$MEM_RES / 2" | bc`"m \ | |
--expose=$SRV_PORT \ | |
-m "$MEM_RES"M \ | |
-c $CPU_RES \ | |
-e "CONSUL=$CONSUL" \ | |
-e reschedule:on-node-failure \ | |
-e affinity:ch_name!=~$CH_NAME \ | |
-e "SRV_PORT=$SRV_PORT" \ | |
-e "CH_NAME=$CH_NAME" \ | |
-e "CH_RES=$CH_RES" \ | |
-l "ch_name=$CH_NAME" \ | |
-l "ch_res=$CH_RES" \ | |
docker-reg.ilikehd.com/transcoder:latest \ | |
-loglevel warning \ | |
-stream_loop -1 \ | |
-i $SRC \ | |
-c:a libfdk_aac -b:a 128k \ | |
-c:v libx264 -preset superfast -r 25 \ | |
-force_key_frames "expr:gte(t,n_forced*6)" \ | |
-b:v "$CH_BAND"k -minrate "$CH_BAND"k -maxrate "$CH_BAND"k \ | |
-bufsize "`echo "$CH_BAND * 2" | bc`"k \ | |
-vf "scale=-2:$CH_RES,format=yuv420p" \ | |
-flags -global_header -hls_time 6 -hls_list_size 50 \ | |
-hls_flags delete_segments -hls_allow_cache 1 -use_localtime 1 \ | |
-hls_segment_filename $CH_NAME-$CH_RES-%Y%m%d-%s.ts \ | |
-segment_list_flags +live \ | |
chunklist.m3u8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment