shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.06k stars 1.33k forks source link

Shaka player skips some fragments causing the captions to flash (appear and disappear quickly) #4165

Closed vishnump-discovery closed 2 years ago

vishnump-discovery commented 2 years ago

We found that even though the fragmented mp4 caption files are in compliant with the standard, the Shaka player skips some fragments causing the captions to flash (appear and disappear quickly).

What link can we use to reproduce this? https://shaka-player-demo.appspot.com/demo/#audiolang=en-GB;textlang=en-GB;uilang=en-GB;asset=https://gtp-public-test-us-east-1.s3.amazonaws.com/flashing-captions-issue/fmp4-2sec/master.mpd;panel=CUSTOM%20CONTENT;build=uncompiled

What version of Shaka Player are you using? v3.2.4-uncompiled

What browser and OS are you using? Chrome/100.0.4896.127

What did you do?

  1. Opened the shaka player demo page
  2. We played the content using the manifest url - https://gtp-public-test-us-east-1.s3.amazonaws.com/flashing-captions-issue/fmp4-2sec/master.mpd
  3. Opened the devtools
  4. After enabling the captions from settings icon, We can see the error message in console like "WVTT sample duration unknown, and no default found!", "Aborting current segment request."

What did you expect to happen?

The shaka player should show all the captions properly

What actually happened?

During the playback if we enable captions from settings icon, We can't see the captions properly based on the window duration on the player. We see the following errors in the Shaka player web console output: "WVTT sample duration unknown, and no default found!", "Aborting current segment request. "

Based on our analysis, I see that this error is logged if there is no duration set in the samples in trun and also there is no default duration is set in tfhd box. But by analyzing the fragmented mp4s, I can see that, if trun has no sample duration, we have it set in the tfhd header. But some how Shaka player is not getting the default duration from the tfhd header.

Screenshot 2022-04-26 at 10 07 33 PM

image-20220318-165257

avelad commented 2 years ago

@vishnump-discovery can you review if the parser is correct? https://github.com/shaka-project/shaka-player/blob/main/lib/util/mp4_box_parsers.js#L18

vishnump-discovery commented 2 years ago

I think this changes are already there with US and we are able to reproduce the issue. I shared the sample manifest url for reproducing the issue - https://gtp-public-test-us-east-1.s3.amazonaws.com/flashing-captions-issue/fmp4-2sec/master.mpd

This issue can be reproducible in the shaka player version V3.3.4 also. shaka demo page link - https://shaka-player-demo.appspot.com/demo/#audiolang=en-GB;textlang=en-GB;uilang=en-GB;asset=https://gtp-public-test-us-east-1.s3.amazonaws.com/flashing-captions-issue/fmp4-2sec/master.mpd;panel=CUSTOM%20CONTENT;build=uncompiled

Can you please check the issue?

joeyparrish commented 2 years ago

The flags field of your tfhd box is invalid. The value is 0x020000. The track ID is required, and your case, is then followed by another 4 bytes. The flag bits are supposed to indicate which fields follow the track ID. Clearly you mean those 4 bytes to be interpretted as a field, but 0x020000 is not a valid flag. The valid values are 0x000001 (base_data_offset), 0x000002 (sample_description_index), 0x000008 (default_sample_duration), 0x000010 (default_sample_size), and 0x000020 (default_sample_flags - not read by Shaka).

This appears to be a bug in your content packaging.

github-actions[bot] commented 2 years ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.

sriramhd commented 2 years ago

@joeyparrish Apologies for the delayed response. We'll follow up internally with our packaging folks and report back. Thanks for the pointers!