video-dev / hls.js

HLS.js is a JavaScript library that plays HLS in browsers with support for MSE.
https://hlsjs.video-dev.org/demo
Other
14.48k stars 2.55k forks source link

AV1 change level freeze image until next segment #6355

Open Jumaron opened 3 months ago

Jumaron commented 3 months ago

What version of Hls.js are you using?

v1.5.8

What browser (including version) are you using?

newest Chrome, newest Microsoft Edge

What OS (including version) are you using?

Windows 11

Test stream

No response

Configuration

{default}

Additional player setup steps

No response

Checklist

Steps to reproduce

  1. Insert a Player
  2. Play a playlist including an AV1 video

Expected behaviour

Switch level and flush out the current frame for the new quality

What actually happened?

Audio goes without a change but the video freezes to the next segment and when the next segment arrives it continues playing.

Console output

Play current segment on change (video)

Chrome media internals output

No response

Jumaron commented 3 months ago

It works in Firefox wow o.0 But it doesn't work in any chromium related one :/

robwalch commented 3 months ago

Can you provide more details regarding "flush out the current frame for the new quality"?

Please provide precise steps to reproduce.

If you remove the video buffer at the playhead, video playback will appear frozen until it reaches the next key frame after appending over the playhead.

Jumaron commented 3 months ago

Sorry i meant this one: Instant switching (immediate quality switch at current video position) Edit: I should note that i use this with addition to VidStack where the error first appeared, but it still insists when using the demo Website for testing.

robwalch commented 3 months ago

To avoid dropped frames perform a smooth switch. Chrome does not render frames that are dependent on a keyframe appended earlier than the playhead. This is a browser issue. HLS.js is not responsible for decoding and rendering the media appended to the video SourceBuffer.

robwalch commented 3 months ago

Note that as a workaround you can perform a tiny seek following the buffer appended event.

robwalch commented 3 months ago

This is related to #3596. There is some work to report these late appends with partial or under-reported dropped frames. As part of that work we could add the option to perform a nudge (tiny seek) to render video following the append.

Jumaron commented 3 months ago

This is related to #3596. There is some work to report these late appends with partial or under-reported dropped frames. As part of that work we could add the option to perform a nudge (tiny seek) to render video following the append.

I would love if you could implement this 👍 Thanks for keeping the work up your my number 1 solution regarding on-demand video streaming

Jumaron commented 3 months ago

Using it with hls-level-switching works even better just like i would expect thank you very much

raxxarr commented 2 weeks ago

I use this to workaround:

function nudgeForSwitchLevel (event, data) {
  if (data.frag.level === this.currentLevel) {
    this.off(Hls.Events.FRAG_BUFFERED, nudgeForSwitchLevel);
    this.media.currentTime = this.media.currentTime + 0.01;
  }
}

hls.on(Hls.Events.FRAG_BUFFERED, nudgeForSwitchLevel);
hls.currentLevel = someLevel;