Skip to content

Instantly share code, notes, and snippets.

View hardeepnarang10's full-sized avatar
:octocat:

Hardeep Narang hardeepnarang10

:octocat:
View GitHub Profile
@hardeepnarang10
hardeepnarang10 / Transcode Challenges.md
Last active October 31, 2020 05:17
Cluster-optimized HLS transcoder command (ffmpeg).

Transcode.sh

ffmpeg -i <input file> -hide_banner -y -c:a aac -ar 48000 -c:v h264 -profile:v baseline -crf 20 -sc_threshold 0 -pix_fmt yuv420p -hls_time 10 -strict -2 -vsync 2 -vf scale=w=XXX:h=XXX -b:v 800k -maxrate XXXk -bufsize 1200k -b:a 96k -hls_time 10 -f hls -hls_list_size 0 <output file>

Replace XXXs for scale settings to match your mediaplayer. Preferable to use an autoscaler on upper-medium settings first and let it process heavier resolutions in background. Maxrate of 1000k-1200k should work fine in most cases - keeping note that bufsize is set to 1200k.

Challenges with Transcoders

Can get stuck every now and then. Use health monitor to pass the following checks and have Kubernetes restart container:

alias cls="clear"
alias python="python3"
alias py="python3"
alias pip="pip3"
for file in /etc/profile.d/*.sh
bass source $file
end