Knowledge Base
FFmpeg command to convert MP4 to HLS ABS formats for streaming
This is a follow up of this article. The difference between the two is that this article will show you how to use one command for FFmpeg that will create a collection of video fragments that combined will be your static HLS stream with support for ABS (Adaptive Bit-rate Streaming).
![](https://livestream.puntenel.nl/wp-content/uploads/sites/14/2021/02/httpstreaming.jpg)
![](https://livestream.puntenel.nl/wp-content/uploads/sites/14/2021/02/manifest.jpg)
Of course, you will need to replace INPUTFILENAME in the example below with the file name of your mp4 that you want to have available in HLS format.
ffmpeg -hide_banner -y -i INPUTFILENAME.mp4 \ -vf scale=w=640:h=360:force_original_aspect_ratio=decrease \ -c:a aac -ar 48000 -c:v h264 -profile:v main \ -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 800k -maxrate 856k \ -bufsize 1200k -b:a 96k -hls_segment_filename OUTPUT/360p_%03d.ts OUTPUT/360p.m3u8 \ -vf scale=w=842:h=480:force_original_aspect_ratio=decrease \ -c:a aac -ar 48000 -c:v h264 -profile:v main \ -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 1400k -maxrate 1498k \ -bufsize 2100k -b:a 128k -hls_segment_filename OUTPUT/480p_%03d.ts OUTPUT/480p.m3u8 \ -vf scale=w=1280:h=720:force_original_aspect_ratio=decrease \ -c:a aac -ar 48000 -c:v h264 -profile:v main \ -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 -hls_playlist_type vod -b:v 2800k -maxrate 2996k \ -bufsize 4200k -b:a 128k -hls_segment_filename OUTPUT/720p_%03d.ts OUTPUT/720p.m3u8 \ -vf scale=w=1920:h=1080:force_original_aspect_ratio=decrease \ -c:a aac -ar 48000 -c:v h264 -profile:v main \ -crf 20 -sc_threshold 0 -g 48 -keyint_min 48 -hls_time 4 \ -hls_playlist_type vod -b:v 5000k -maxrate 5350k \ -bufsize 7500k -b:a 192k -hls_segment_filename OUTPUT/1080p_%03d.ts OUTPUT/1080p.m3u8