videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.05k stars 7.45k forks source link

HLS streaming should be more resiliant to video errors #8042

Open strbass28 opened 1 year ago

strbass28 commented 1 year ago

Description

It's very common for videos recorded via UDP to be missing a couple rtp packets every few minutes/hours/days. ffmpeg handles these and happily writes out m3u8 playlists and segments. However, when video-js hits a corruption caused by a missing packet it stops playback and gives the dreaded,

VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) The media playback was aborted due to a corruption problem or because the media used features your browser did not support.

Other players continue to play past the corruption. You do see a brief artifact on the screen but it's barely noticeable.

You can re-encode the video with ffmpeg to play fine, but it would be way better to just skip over the corrupt frame/rectangle.

Is there anyway for video-js to be more resilient to these decode errors?

Reduced test case

http://3.86.76.131/video-js/demo3.html

Steps to reproduce

  1. play back a m3u8 playlist with h.264 encoded segments with a frame corruption. Here's an example http://3.86.76.131/video-js/demo3.html
  2. see that player stops playing and has a corruption. This example has a corruption around second 34
  3. Play the same playlist in VLC or another nameless HLS javascript client and it continues to play.

Errors

VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) The media playback was aborted due to a corruption problem or because the media used features your browser did not support.

What version of Video.js are you using?

7.20.3

Video.js plugins used.

No response

What browser(s) including version(s) does this occur with?

chrome 108

What OS(es) and version(s) does this occur with?

windows 11

gkatsev commented 1 year ago

Interestingly, this stream played just fine for me in Chrome 108 on win 10.

strbass28 commented 1 year ago

Looks like I provided incorrect information. Using the video-js/demo.html app and a m3u8 playlist constructed from H.264 RTSP video with a single missing rtp packet I see the following.

OSX with chrome and firefox reports an error and stops.

Windows 11 with edge or chrome plays through correctly.

OSX and IOS with Safari plays through correctly.

Pretty odd that OSX has different behavior. Any ideas on how to make this more resilient?

gkatsev commented 1 year ago

This is likely not something that can be handled easily by web players. I tried the stream in hls.js's demo page, and it also fails at the same point. Also, added a bunch of #EXT-X-DISCTINUITY tags, which didn't help. The only solution is to reload the video element and seek to a section after the issue (this is what hls.js's demo page does on this error).

strbass28 commented 1 year ago

Why does windows handle it without complaint and OSX stops with an ugly corruption message?

gkatsev commented 1 year ago

Not sure. Differing media stacks?

Unfortunately, I don't have the bandwidth to debug this further.