6

I am streaming long videos which seamlessly loop short video sequences. Thanks to HLS this is possible by having just one video sequence stored and concatenated in a media playlist and separated by #EXT-X-DISCONTINUITY tags

1080_video.m3u8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:10.010000,
0/1080p_0_000.ts
#EXTINF:10.010000,
0/1080p_0_001.ts
#EXTINF:2.635967,
0/1080p_0_002.ts
#EXT-X-DISCONTINUITY
#EXTINF:10.010000,
0/1080p_0_000.ts
#EXTINF:10.010000,
0/1080p_0_001.ts
#EXTINF:2.635967,
0/1080p_0_002.ts
#EXT-X-DISCONTINUITY 
... and so on

This works great. Now I´d like to introduce alternate audio renditions so that I can stream these video loops with various audio tracks. For this, I take each of the long audio files I prepared and split them into many small audio files according to the play length of the video segments. I also understood that if you have #EXT-X-DISCONTINUITY in your video playlist your audio playlist must also have them.

audio.m3u8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.005333,
s000_00.ts
#EXTINF:10.005333,
s000_01.ts
#EXTINF:2.688000,
s000_02.ts
#EXT-X-DISCONTINUITY
#EXTINF:10.005333,
s001_00.ts
#EXTINF:10.005333,
s001_01.ts
#EXTINF:2.688000,
s001_02.ts
... and so on

Video and audio come together in the master playlist.

master.m3u8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="audio",URI="./audio/audio.m3u8"
#EXT-X-STREAM-INF:BANDWIDTH=4500000,RESOLUTION=1920x1080,FRAME-RATE=29.970,NAME="1080p",AUDIO="aac"
1080_video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720,FRAME-RATE=29.970,NAME="720p",AUDIO="aac"
720_video.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1300000,RESOLUTION=852x480,FRAME-RATE=29.970,NAME="480p",AUDIO="aac"
480_video.m3u8

This doesn´t work. It starts playing with video and audio but stalls on the first DISCONTINUITY tag.

My questions:

  1. is what I want to achieve possible at all? taking any audio file and put it together with video by ensuring segment lengths and discontinuity is roughly aligned?
  2. roughly aligned because it is almost impossible to get more precise than what I have above. Segment lengths slightly differ by a few milliseconds. I know HLS players can deal with it but what if discontinuity comes into play? May this be the reason why it is not working for me?
Kay Lerch
  • 71
  • 5

0 Answers0