We are using following command to generate dash and hls file for a given video:

ffmpeg -y -nostdin -loglevel error -i input.mp4 \
        -map 0:v:0  -map 0:v:0 -map 0:v:0  -map 0:v:0  -map 0:v:0  -map 0:v:0 -map 0:a\?:0  \
        -maxrate:v:0 350k -bufsize:v:0 700k  -c:v:0 libx264 -filter:v:0 "scale=320:-2"  \
        -maxrate:v:1 1000k -bufsize:v:0 2000k -c:v:1 libx264 -filter:v:1 "scale=640:-2"  \
        -maxrate:v:2 3000k -bufsize:v:0 6000k -c:v:2 libx264 -filter:v:2 "scale=1280:-2" \
        -maxrate:v:3 245k -bufsize:v:3 600k -c:v:3 libvpx-vp9 -filter:v:3 "scale=320:-2"  \
        -maxrate:v:4 700k  -bufsize:v:3 1400k -c:v:4 libvpx-vp9 -filter:v:4 "scale=640:-2"  \
        -maxrate:v:5 2100k -bufsize:v:3 4200k -c:v:5 libvpx-vp9 -filter:v:5 "scale=1280:-2"  \
        -use_timeline 1 -use_template 1 -adaptation_sets "id=0,streams=v  id=1,streams=a" \
        -threads 8 -seg_duration 5 -hls_playlist true -f dash output/output.mpd

This works and generates hls files also as expected, one sample m3u8 file below:







Now as you notice, the Bandwidth is same for resolution of 320x168, 640x336 and 1280x670, which might have happened because of nature of video.

But the issue with this is in iOS's AVPlayer it always picks the minimum resolution one and never picks the better resolution stream even if it is available because of same bitrate.

So the question I want to ask is: is there some option available to ensure - I always have some difference in the bitrates of different resolutions or more specific, bit rate always increase(may be just by few bytes) for increasing resolutions.


Earlier I was using -b:v option per output instead of -maxrate:v, I was getting following output for same video:




If you see, Bandwidth has increased considerably, for the same video and same video quality, also all the file sizes also increased 4x. as par my understanding with maxrate option, ffmpeg optimises the output and provides only required bandwidth, while with b:v option it forcefully increases the bandwidth to given values without any benefit in terms of quality. So essentially you get same quality video at much higher bandwidth.

Which is why I want to use maxrate option but with increasing bandwidth. If I manually change the bandwidth to increasing order in the output with maxrate option, adaptive bit rate starts to work in iOS's AVPlayer.

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.