0

I am using the following command to convert an existing .mp4 video into HLS format with multiple bitrate and resolution streams

ffmpeg -y \
    -i sample.mp4 \
    -threads 0 \
    -hls_init_time 2 \
    -hls_list_size 0 \
    -hls_key_info_file keyfile \
    -b:v:0 8000k -b:v:1 5000k -b:v:2 2500k -b:v:3 1000k -b:a:0 64k -b:a:1 32k \
    -filter:v:0 scale=-2:1080 -filter:v:1 scale=-2:720 -filter:v:2 scale=-2:480 -filter:v:3 scale=-2:240 \
    -map 0:v -map 0:v -map 0:v -map 0:v -map 0:a -map 0:a \
    -var_stream_map "v:0,a:0 v:1,a:0 v:2,a:0 v:3,a:1" \
    -master_pl_name master.m3u8 \
    "output.m3u8"

I need help with the following

  1. Except for the video with resolution 240, the rest of the resolution format's audio is not working (nothing can be heard).
  2. The first .m3u8 file size is very large compared to the rest of the files. How can I reduce this ?
  3. The size of the .m3u8 files created is quite variant. While some are in 400-500KB, the rest are in 4-6MB for the 1080 variant stream. Is there a way to make the file sizes less variable, since due to the variant file sizes, the quality is switching down to lower resolution.
  • Audio issue is fixed, by mapping it separately for each stream – Abhishek Gn Jun 8 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.