Skip to content

Instantly share code, notes, and snippets.

@juanpablocs
Forked from Andrey2G/encoding.txt
Last active March 22, 2024 22:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanpablocs/6bf486f0a653cc0e92d8ebe74fe075c2 to your computer and use it in GitHub Desktop.
Save juanpablocs/6bf486f0a653cc0e92d8ebe74fe075c2 to your computer and use it in GitHub Desktop.
Video Encoding with multiple resolutions

Encoder mp4 to m3u8

ffmpeg -i https://sample-videos.com/video321/mp4/720/big_buck_bunny_720p_30mb.mp4 \
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 \
-c:v libx264 -crf 22 -c:a aac -ar 48000 \
-filter:v:0 scale=w=480:h=360  -maxrate:v:0 600k -b:a:0 64k \
-filter:v:1 scale=w=640:h=480  -maxrate:v:1 900k -b:a:1 128k \
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k \
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p" \
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3 \
-hls_flags independent_segments -master_pl_name "name-pl.m3u8" \
"name-%v.m3u8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment