Closed MarcusWichelmann closed 3 years ago
HLS.js handles alternate codecs now, but in this case, the two variants are probably treated as redundant levels here (you'll need to verify as I don't have a test stream for this):
https://github.com/video-dev/hls.js/blob/v1.0.3/src/controller/level-controller.ts#L93
Thanks for your fast response. Yeah exactly that part of the code is what I meant. Because of the same bitrates, the two levels are grouped together and the h264 one is not recognized as an option anymore:
Do you have an idea how this special case could be handled cleanly?
There's a hint here:
levelFromSet = levelSet[levelParsed.bitrate]; // FIXME: we would also have to match the resolution here
so these are being grouped by bitrate. As a workaround, you could change the bitrate slightly that would fix the issue with how HLS.js is handling this.
What we want to do to handle redundancy correctly would be to require that bitrate (BANDWIDTH), RESOLUTION, and CODECS all match for them STERAM-INF variants to be grouped into a single level set here.
Okay, that's what I thought about, too. I suppose some simple string representation of these three properties could be used as the key for levelSet here.
I will see when I find time to make a PR for that.
Slightly changing the bitrate of one of the streams doesn't look like a clean option to me because I don't want priorization to happen based on one stream having a higher bitrate in this case.
@MarcusWichelmann,
I started on these changes (creating key based on attributes for level sets) and see an opportunity to clean up some unit tests as well. I'll put up a PR and link it to this issue so you can take a look.
Here it is #3889 https://deploy-preview-3889--hls-js-dev.netlify.app/demo/
Very nice! I'll give it a try shortly and comment on the PR after that.
Hi,
my master.m3u8 provides two video stream variants with the same bitrate and same resolution but different codecs: HEVC for great quality and H264 for compatibility with most web browsers. But when playing this stream with hls.js, it gives me a
manifestIncompatibleCodecsError: no level with compatible codecs found in manifest
error.After having a short look into the code, it seems like, when multiple levels/streams have the same bitrate, it only respects the first one and ignores all the following. So it only sees the first HEVC stream, notices that it is not playable and doesn't look further to the H264 stream that would be playable.
Maybe this behaviour could be improved?
What version of Hls.js are you using?
v1.0.3 on https://hls-js.netlify.app/demo/
What browser and OS (including versions) are you using?
Google Chrome 89.0.4389.72 on Fedora Linux
Test stream:
My stream isn't public but here is the relevant part, the master.m3u8:
Configuration:
Checklist
Steps to reproduce
Expected behavior
The player skips the unsupported streams and selects the playable (H264) stream.