Here is my TVheadend mod docker image with streamlink integration:
https://198.50.196.133/tvheadend_mod-streamlink.tar
You can use the same configuration just switch which container you’re pointing to after importing the image.
What you want to do is create a spawn profile:
Go to Configuration - Stream - Stream Profiles then select Add:
Under the type drop down select MPEGTS-Spawn/built-in.
Profile name: spawn
Enabled: checked
Default: checked
Data timeout: 5
Default priority: Normal
Force priority: 0
Restart on error: checked
Continue if descrambling fails: checked
Descrambling timeout: 2000
Switch to another service: checked
Preferred service video type: None
Randomize service selection: checked ← this is your new service randomization function I modded (works with a pass profile too)
Command line: /usr/bin/ffmpeg -hide_banner -loglevel error -i pipe:0 -f lavfi -i anullsrc -c:v copy -c:a ac3 -b:a 640k -ac 6 -shortest -f mpegts pipe:1
Mime type: video/mp2t
Kill timeout: 5
Rewrite service ID: 1 then checkmark everything below this
Go to Configuration - Users - Access Entries:
Select your user
Change Streaming profiles to: spawn
In xTeVe change your playlist URL from profile=pass to profile=spawn. Save and then update.
Now under Status - Subscriptions you should see under the Profile column it now says spawn while streaming instead of pass.
What this spawn profile does is transcode the audio on the fly to Dolby 5.1 so when a stream dies and TVheadend goes to select another service at random and the service happens to have a different audio format than the previous it will transition correctly without glitching the video since the audio will stay the same/synced via the transcode. It also adds a silent audio track if no audio exists.
If you’re interested in getting streamlink working let me know. It allows streaming directly from websites. There’s a lot of plugins for various websites. If you look into it and are interested I’ll explain further. It’s a process getting the plugins into the container that aren’t already included by default and the .m3u file needs to be formatted a certain way.