-
-
Save dlobjoie/d2159dbd9a9ccbebca7bad78af11e9a1 to your computer and use it in GitHub Desktop.
FFMPEG HLS script.
This file contains hidden or 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
ffmpeg -i sample.mp4 \ | |
-filter_complex \ | |
"[0:v]split=4[v1][v2][v3][v4]; \ | |
[v1]scale=w=1980:h=1080[v1out]; \ | |
[v2]scale=w=1280:h=720[v2out]; \ | |
[v3]scale=w=854:h=480[v3out]; \ | |
[v4]scale=w=640:h=360[v4out]" \ | |
-map [v1out] -c:v:0 libx264 -profile main -b:v:0 5000k -minrate 4500k -maxrate 5300k -bufsize 5000k -preset slow -g 120 -keyint_min 120 -sc_threshold 0 \ | |
-map [v2out] -c:v:1 libx264 -profile main -b:v:1 3000k -minrate 2500k -maxrate 3200k -bufsize 3000k -preset slow -g 120 -keyint_min 120 -sc_threshold 0 \ | |
-map [v3out] -c:v:2 libx264 -profile main -b:v:2 1500k -minrate 1250k -maxrate 1600k -bufsize 1500k -preset slow -g 120 -keyint_min 120 -sc_threshold 0 \ | |
-map [v4out] -c:v:3 libx264 -profile main -b:v:3 800k -minrate 700k -maxrate 900k -bufsize 800k -preset slow -g 120 -keyint_min 120 -sc_threshold 0 \ | |
-map a:0 -c:a:0 aac -b:a:0 192k -ac 2 \ | |
-map a:0 -c:a:1 aac -b:a:1 128k -ac 2 \ | |
-map a:0 -c:a:2 aac -b:a:2 128k -ac 2 \ | |
-map a:0 -c:a:3 aac -b:a:3 96k -ac 2 \ | |
-f hls \ | |
-hls_time 4 \ | |
-hls_playlist_type vod \ | |
-hls_segment_type mpegts \ | |
-hls_segment_filename stream_%v/file%03d.ts \ | |
-master_pl_name master.m3u8 \ | |
-var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2 v:3,a:3" stream_%v/stream.m3u8 | |
# ABR HLS VOD streaming | |
# Bitrates from https://docs.peer5.com/guides/production-ready-hls-vod/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment