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
1.95k stars 502 forks source link

Continue with existing playlists #1008

Closed Bec-k closed 4 months ago

Bec-k commented 2 years ago

How to tell shaka-packager to continue working with existing HLS playlists from where it stopped? By adding discontinuity HLS tag and continue writing into existing playlist, like ffmpeg HLS packager is doing it. Currently shaka-packager is just overwriting both video.m3u8 and audio.m3u8 and starts them from scratch, like there wasn't any playlists before...

Bec-k commented 2 years ago

Command i'm using right now:

./packager --segment_duration 15 --hls_playlist_type EVENT --hls_master_playlist_output /var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/master.m3u8 in=udp://127.0.0.1:5555,stream=video,output=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/video.mp4,init_segment=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/video_init.mp4,segment_template=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/video_segment_$Number%03d$.m4s,playlist_name=video.m3u8 in=udp://127.0.0.1:5555,stream=audio,output=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/audio.mp4,init_segment=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/audio_init.mp4,segment_template=/var/local/acp/dashboards/packages/cctv-vod/video_tmp/fuse/73f687ae-86ff-489c-b09b-9861563d6fcc/2021-11-23/audio_segment_$Number%03d$.m4s,playlist_name=audio.m3u8
Bec-k commented 2 years ago

You can try start it and then restart it, it will write from scratch each time, totally ignoring whether there was anything in playlists or not. Possibly i'm missing some options which are not in documentation.

Canta commented 2 years ago

Shaka packager indeed will ignore the previous playlists, and create new ones. I don't believe ffmpeg either do such a thing between runs, so I don't fully understand what are you refering to that ffmpeg does.

If your use case is honor previous content, then you can't do that with shaka packager, and you'll need to add some tools in your pipeline, like scripts for file and playlist manipulation.

However, if your use case is about enable players to keep playing, even after packager restarts, that is actually doable with shaka packager alone. For that use case, you can use the --hls_media_sequence_number option, as explained here: https://github.com/google/shaka-packager/issues/691

cosmin commented 4 months ago

The overall request to resume is covered by #89