shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
2k stars 510 forks source link

ext-x-discontinuity flag #601

Closed bencecsire closed 3 years ago

bencecsire commented 5 years ago

Hello,

the issue is not related to Shaka Packager (most likely it is up to hls.js player, because other players could play my stream), however maybe Shaka could offer a solution. I have a similar issue like this just with live streams, when I start them: https://github.com/video-dev/hls.js/issues/1154

I would like to try, if ext-x-discontinuity tag could or could not solve my problem too. I could not find how to add this flag in Shaka Packager, can you help me about it?

This is the command I use:

/home/mediaadmin/shaka_packager/src/out/Release/packager \ 'in=udp://239.190.176.191:5000,stream=0,segment_template=720fairplay$Number$.ts,playlist_name=720.m3u8' \ 'in=udp://239.190.176.191:5000,stream=1,segment_template=480fairplay$Number$.ts,playlist_name=480.m3u8' \ 'in=udp://239.190.176.191:5000,stream=2,segment_template=324fairplay$Number$.ts,playlist_name=324.m3u8' \ 'in=udp://239.190.176.191:5000,stream=3,segment_template=216fairplay$Number$.ts,playlist_name=216.m3u8' \ 'in=udp://239.190.176.191:5000,stream=4,segment_template=1audio$Number$.aac,hls_group_id=aac,hls_name=magyar,playlist_name=audio1main.m3u8' \ 'in=udp://239.190.176.191:5000,stream=5,segment_template=2audio$Number$.aac,hls_group_id=aac,hls_name=angol,playlist_name=audio2main.m3u8' \
--preserved_segments_outside_live_window 5 \ --time_shift_buffer_depth 60 \ --clear_lead=0 \ --hls_playlist_type=LIVE \ --hls_master_playlist_output h264_master.m3u8

Best regards, Bence

kqyang commented 5 years ago

@bencecsire Which version of Shaka Packager are you using?

In a recent commit (https://github.com/google/shaka-packager/commit/b85e5c9368f41cbda52afc4147f866303b363e7d), we added the ability to auto-detect discontinuities in the source stream and an EXT-X_DISCONTINUITY tag will be inserted automatically when detected. Can you try if it can solve your problem?

bencecsire commented 5 years ago

Thanks for the answer. I used 26997bb.

I have updated it. The EXT-X_DISCONTINUITY tag did not insert, so probably the source stream is fine. However in the new version there is often an 'Unusually large number of cached timestamps' warning message, if I run the command. With the previous release I have never seen that. Do you have any idea what could cause it? Here is a screenshot about it: https://imgur.com/lAR75If If you need any more information, please let me know.

kqyang commented 5 years ago

@bencecsire Are you seeing the warning continuously or only when the packager starts?

bencecsire commented 5 years ago

Only when packager starts. And not every start, only 3 or 4 out of 5 times.

bencecsire commented 5 years ago

Dear kqyang,

This issue is still up for us, and the JW player support sais, it is probably with packaging/encoding, so I would like to ask your help again. The issue is if I start the stream sometimes there is an 'uncaught range error'. The frequency is about 1 out of 5 times. Here is a screenshot about the console messages: https://imgur.com/pgdmjsv JW using hls-js (test page: https://hls-js.netlify.com/demo/) to play hls streams in Chrome, Firefox etc.

Here you can find a working hls with single audio: https://wowza35-vhg.connectmedia.hu/chromecast/TVE-001_1a_hls.smil/playlist.m3u8 And this one is a working hls with multi audio: https://cdn.connectmedia.hu/2003/index.m3u8

You can reach the hls with multi audio packaged by Shaka, here: https://csireb-test-8000.connectmedia.hu/h264_master.m3u8

The Packager command I used: packager \ 'in=udp://239.190.176.166:5000,stream=0,segment_template=480fairplay$Number$.ts,playlist_name=480.m3u8' \ 'in=udp://239.190.176.166:5000,stream=1,segment_template=324fairplay$Number$.ts,playlist_name=324.m3u8' \ 'in=udp://239.190.176.166:5000,stream=2,segment_template=216fairplay$Number$.ts,playlist_name=216.m3u8' \ 'in=udp://239.190.176.166:5000,stream=3,segment_template=1audio$Number$.aac,hls_group_id=aac,hls_name=magyar,playlist_name=audio1main.m3u8' \ 'in=udp://239.190.176.166:5000,stream=4,segment_template=2audio$Number$.aac,hls_group_id=aac,hls_name=english,playlist_name=audio2main.m3u8' \ --preserved_segments_outside_live_window 5 \ --time_shift_buffer_depth 60 \ --clear_lead=0 \ --hls_playlist_type=LIVE \ --hls_master_playlist_output h264_master.m3u8

The issue is quite complicated, because I can play the stream with any other hls players without troubles (I have tried with bitmovin player https://bitmovin.com/demos/stream-test, theo player https://demo.theoplayer.com/test-your-stream-with-statistics and kaltura playerhttp://player.kaltura.com/modules/KalturaSupport/tests/HLSPlaybackTester.html). However you can see there are streams which work in hls-js too.

I believe the main difference between the master playlist files are how they handle the audios. In the single audio hls it is embedded into the video, while with the multiaudio there are two more lines:

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=147033,CODECS="mp4a.40.2",AUDIO="tve-audios"

11.m3u8

EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=147033,CODECS="mp4a.40.2",AUDIO="tve-audios"

12.m3u8

Do you have any idea, how to create master playlist files like the working ones? Or any other idea (maybe related to encoding not packaging) what could bring/solve this issue?

Bence

kqyang commented 5 years ago

@bencecsire Sorry for the late reply. I looked your live content. I did see a problem in packager that may be the root cause. I have filed #629 to track the bug, which will be addressed soon.

bencecsire commented 5 years ago

Thanks for the great support! I have one last question. Please can you tell me, how can I check the value of this ID3 PRIV tag?

kqyang commented 5 years ago

You can use a binary editor and look for "com.apple.streaming.transportStreamTimestamp". The bytes after that is the value of the timestamp.

kqyang commented 5 years ago

@bencecsire The fix for #629 has been merged. Let us know if it solves your problem too.

bencecsire commented 5 years ago

Sorry for the late answer, but no, sadly it did not solve my problem.

Also I've tried to playback my stream with Shaka Player and I could not start with it. This is the error message it sais, maybe it is helpful: https://imgur.com/QZjkc3v You can still debug with this URL: https://csireb-test-8000.connectmedia.hu/h264_master.m3u8

kqyang commented 5 years ago

Shaka Player does not support HLS Packed Audio, so the error is expected.

I'll take a look at your stream again.

In the mean time, can you try output the audio as TS instead of AAC?

bencecsire commented 5 years ago

It is not working with .ts nor with single audio aac. I am using .aac to be able to chromecast the stream.

kqyang commented 5 years ago

@bencecsire Looks like some weirdness in hls.js then. Do you have a debug stream with audio in TS I can try and compare?

bencecsire commented 5 years ago

Hello kqyang,

sorry for this really late answer, but I was quite busy, and backloged this issue. I can provide you the same stream with TS audio, but sadly not both at the same time. You can reach it here: https://csireb-test-8000.connectmedia.hu/h264_master.m3u8

Also I have noticed that in the audio playlist files the #EXTINF tag values are not the same (some of them are 5.995, the other ones are 6.016, while in the video playlist files the segment lenghts are always 6 seconds. Maybe it could cause the problem.

astinus-1 commented 3 years ago

Is this still an issue that you're able to reproduce? If so, could you provide a new content link? The current link has expired, but I'd be happy to give this a look if you're still seeing the issue. Thanks!

shaka-bot commented 3 years ago

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