Hello.
I use the packager to generate HLS for live stream.
For test purposes I use FFmpeg to generate a stream.
First I run Shaka in Docker:
packager \
'input=udp://
0.0.0.0:5004,stream=video,init_segment=hls/video_init.mp4,segment_template=hls/video_$Number$.ts,playlist_name=video.m3u8' \
'input=udp://
0.0.0.0:5004,stream=audio,init_segment=hls/audio_init.mp4,segment_template=hls/audio_$Number$.ts,playlist_name=audio.m3u8' \
--hls_master_playlist_output hls/playlist.m3u8 --hls_playlist_type LIVE
Then I run FFmpeg on host machine:
ffmpeg \
-f lavfi -re -i "testsrc=duration=-1:size=1280x720:rate=30" \
-f lavfi -re -i "sine=f=50:beep_factor=6" \
-pix_fmt yuv420p \
-c:v libx264 -preset:v ultrafast -profile:v high -level 3.1 -tune:v zerolatency -r 30 -g 60 -sc_threshold 0 \
-c:a libfdk_aac -preset:a ultrafast \
-f mpegts udp://$(docker-machine ip default):5004
Unfortunately, when I try to play those files with Shaka Player I got the following error:
Shaka Error MANIFEST.HLS_MEDIA_SEQUENCE_REQUIRED_IN_LIVE_STREAMS ()
As far as I can see from
Apple docs (Live Playlist (Sliding Window) section):
For live sessions, the index file is updated by removing media URIs from the file as new media files are created and made available.
My playlists look like this:
hls/playlist.m3u8
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="stream_0",URI="audio.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=532398,CODECS="avc1.42c01f,mp4a.40.2",RESOLUTION=1280x720,AUDIO="audio"
video.m3u8
hls/video.m3u8
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:11
#EXT-X-MAP:URI="video_init.mp4"
#EXTINF:10.000,
video_1.ts
#EXTINF:10.000,
video_2.ts
#EXTINF:10.000,
video_3.ts
#EXTINF:10.000,
video_4.ts
#EXTINF:10.000,
video_5.ts
#EXTINF:10.000,
video_6.ts
#EXTINF:10.000,
video_7.ts
#EXTINF:10.000,
video_8.ts
#EXTINF:10.000,
video_9.ts
#EXTINF:10.000,
video_10.ts
#EXTINF:10.000,
video_11.ts
#EXTINF:10.000,
...
I have read from the packager documentation that:
Packager does not support removing old segments internally. The user is responsible for setting up a cron job to do so.
But I think it is related to removing files itself.
As I understand the packager should remove some segments from playlist and increment EXT-X-MEDIA-SEQUENCE tag.
There is a code related to that, but unfortunately I am not able to understand it. In which cases we would get into that
else branch?
So, my playlists is just getting longer and there is
EXT-X-MEDIA-SEQUENCE tag in there.
Could you please tell me to figure it out?
It there is anything I could do to add EXT-X-MEDIA-SEQUENCE to playlist?
Is it a bug in the packager or it is me missing something?
Thank you.