0

I have a video streaming player and get back an array of available video quality bitrates for a stream. I am trying to set up a custom url param override to set the bitrate but unsure if I should actually use the bitrate number itself.
On a test stream I have, the highest available bitrate is 2341203 and it's 720p video. The lowest is 630000 and it's 360p video.
Is it safe to assume that someone always knows the quality of video to expect based on the bitrate, regardless of the device used? For example, is a bitrate of around 2341203 always in the 720p range of quality or does it vary depending on the device streaming? If so, I would use a bitrate as a query param: http//myvideo.com&bitrate=230000 and then find the quality option in the array that has a bitrate closest to that param.
If bitrate isn't consistent, I was just going to use a "low", "medium", "high" scale as a query param

  • 2
    The bitrate for each stream representation is specific to the stream (content) and is used by the player to dynamically chose a quality if the available bandwidth changes, a technique called adaptive bitrate streaming. This is defined in the stream's manifest, therefore the levels are consistent across all devices loading the same manifest. Most players already provide a way to manually select a quality. You would need to check each time the available representations in the manifest. – aergistal May 14 '21 at 13:14
  • thanks @aergistal ! If user-1 streamed live from their iPad, user-2 streamed from an old webcam and user-3 streamed from an HD webcam, would a bitrate of `230000` equate to the same quality amongst all the different stream contents? –  May 14 '21 at 14:09
  • 1
    no, the bitrate which is the max (peak) value will be dependent on the source material and the encoding parameters for that particular stream. As a simple example think of the resolution and frame-rate which may also differ: larger images require more data and 60 fps will require more bandwidth than 30fps. Even for the same resolution you can vary the compression rate for better quality or lower delay which will have an impact on bitrate. If you control the encoding you can of course target your own levels. – aergistal May 14 '21 at 14:42
  • fantastic explanation. Thanks for taking the time to inform me! –  May 14 '21 at 17:54

1 Answers1

0

The manifest file that is sent as a part of HLS has the bitrate and size for each stream:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=275000,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=426x240
240/manifest.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=880000,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=640x360
360/manifest.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2860000,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=1280x720
720/manifest.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4840000,CODECS="avc1.66.30,mp4a.40.2",RESOLUTION=1920x1080
1080/manifest.m3u8

This video has 4 streams ranging in size from 240p to 1080p (with corresponding bitrates of 275 KBPS to 4,800 KBPS.)

Now the player can look at the device screen size (RESOLUTION) and the device network (BANDWIDTH) and decide which stream is optimal playback.

Doug Sillars
  • 1,625
  • 5
  • 7
  • How to calculate BANDWIDTH for main m3u8 file – Yusuf Jun 21 '23 at 20:58
  • Also if my screen display size is 1920x1080 but network is very poor, will it show 426x240 i.e. first stream ? if yes then it does not depend on resolution, it only depends on network please correct – Yusuf Jun 21 '23 at 21:13
  • 1
    it totally depends on the player logic.. Many players focus only on screen size.. and not bandwidth. – Doug Sillars Jun 27 '23 at 21:45