I need to combine separate audio and video streams into one playlist. I did it, but I have a problem. After a random time, the audio stops playing, or very rarely, the audio is OK, but freezes the video. Audio and video sources are links to a third-party server, and when I test the sources separately, everything works fine.
Here are my playlist files:
audio.m3u8
#EXTM3U
#EXTINF:190,audio
https://third-party-server.com/audio-url
#EXT-X-ENDLIST
video.m3u8
#EXTM3U
#EXTINF:190,video
https://third-party-server.com/video-url
#EXT-X-ENDLIST
main.m3u8
#EXTM3U
#EXT-X-VERSION:5
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="merge",DEFAULT=YES,AUTOSELECT=YES,URI="audio.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=646043,CODECS="opus,avc1.4d401e,mp4a.40.2",RESOLUTION=640x360,AUDIO="audio"
video.m3u8
#EXT-X-ENDLIST
Information about the sources:
audio: bitrate: 144209, audioSampleRate: 48000, codecs: "opus",
video: resolution: 640x360, bitrate: 646043, codecs: "avc1.4d401e",
Both sources have the same duration: 190 seconds
I experimented a lot. I used sources with other qualities (the server allows you to get many formats), I changed "BANDWIDTH", tried other codecs. But nothing helped, my audio still stops working. Also, when I test one source, I can use rewind, but the combined playlist stops working when I try to rewind.
It all looks like a buffering problems, but I haven't found a way how to configure this in m3u8.
I will be glad to hear your advice.