Thanks to JKalchik and sixxnet for the information in this thread. Y’all have both given details I hadn’t come across in months of studying this stuff. This thread is gold to me.
@sixxnet You’ve inspired me to work on TVHeadend again so I am getting it working first before going down the failover road you have laid out here.
I have a a question though… One of the m3u files I add under “networks” has streams that won’t play unless I edit the individual muxes to pipe them through ffmpeg. For example, I change the URL box in a Mux from “http://10.10.10.10/stream/2” to “pipe:///usr/bin/ffmpeg -loglevel fatal -i http://10.10.10.10/stream/2 -vcodec copy -acodec copy -f mpegts -tune zerolatency pipe:1”
Do I have to do this for each of the channels from this network? Is there a way to edit the network (m3u) so the Muxes are all already like this instead of editing hundreds of channel manually? I’m a linux n00b but I suppose I could use a script to edit the m3u instead if this isn’t possible inside TVH?
EDIT: Seems like you do have to do them all or use a script on the m3u. Again, solid thread so thanks all.
Ohhhhh yeah, that does make more sense. Initially it isn’t working though.
It’s launching ffmpeg and using my newly created spawn profile, I referenced your earlier post as well for that.
This is from the log:
[ERROR] spawn: av_interleaved_write_frame(): Broken pipe
[ERROR] spawn: Error writing trailer of pipe:1: Broken pipe
The channel coming from the mux that I edited before is working though.
EDIT: I restarted the TVHeadend container and now i get a different error in the log. Now it’s “service instance is bad, reason: No input detected” and “timeout waiting for packets.”
That’s actually the same error I get with the ‘pass’ profile unless I modify the mux with the ffmpeg pipe.
This is typically alright and if it works it works.
In the first example pipe:0 woud take whatever is being output by TVheadend and then convert it and send it back out pipe:1. Can you open http://10.10.10.10/stream/2 directly in VLC and have it play? I’m wondering what type of stream this is actually serving…
It does play in VLC. I’m not sure how to get VLC to tell me about the container, but the codec tab says
Codec: H264 - MPEG-4 AVC (part 10) (h264)
audio codec: ADTS
If you go to Configuration - DVB Inputs - Muxes and then press the play button on the left of the MUX with the original URL eg: http://10.10.10.10/stream/2 does it then play?
Also doesn’t play from there. I found in VLC that the container is actually TS anyway. I’m not sure what the issue is yet. I’ll keep poking around, thanks for the help.
If you use Channels DVR to access TV Everywhere then this can easily be intergrated into Plex Live TV. Use Channels as a backend service, export the m3u playlist from Channels and then import it into xTeVe/TVheadend. Once this is set up then you can integrate xTeVe/TVheadend into Plex and there you have it, your TV Everywhere channels on Plex.
I’m still screwing around with this and so far I agree that using TVH could be a huge improvement to Plex/Emby.
I’m having an issue with TVH not failing over to the second service assigned to a channel. It chooses one of the two services and after the timeout it just keeps hitting that one service again and not trying the other.
I’ve followed your instructions and I’m using PASS profile for now. I will move to ‘spawn’ as the default once the fail-over is working and I assume I’ll get the sync issues you mentioned.
Based on other people’s threads about this issue I have a suspicion about it.
In the “DVB Inputs” > “Networks” tab, do you have assigned priority to the networks? I left both at ‘1’ because I didn’t have a preference, but it seems like there may be a bug with that. I picked on to set to 10 just to see if it makes any difference.
“Restart on Error” and “Switch to another service” are checked in the pass profile…
EDIT: That was it! You have to set a higher priority on one of the networks for the fail-over to function. I found a thread that said the values need to be 10,20,30, etc so I set one to 10 and now it’s working as expected.
Are you using my modded TVHeadend? I added a selection in the Stream Profile settings (Configuration - Stream - Stream Profiles) called “Randomize service selection” This is the feature that will randomize what service is selected when viewing a channel and without it TVHeadend will try each service in a set order that never changes. Which is likely what you’re seeing now. I also changed some hard coded timeouts so when the streams die and/or switch it keeps going instead of what you’re seeing which is probably another reason your are experiencing your issue.
The streaming priority on each network is set to 1 on my end and I do not nor have I ever changed it for the failover to function. Even without my mods. What this could do is set the order in which each network is tried but having them all set the same does not have any impact on the failover function besides it being a set order all the time. You likely have something else set wrong.
I also recommend setting the data timeout to 5 inside the stream profile otherwise it will get stuck. I’m pretty sure the default is 0 and failover will absolutely not work with it set to 0.
Another thing is under your Networks you should set “Maximum timeout (seconds):” to 5 also.
Lots of options to mess everything up haha.
On another note I only had one network set up but that network had many services for the same channel so this also might be why I was having different functionality than you. You could also set the priority for each service too if you wanted the set order changed or use my randomization mod.
Question for you (or anyone else who might know). Does Plex recognize any of the group-related data in the M3U file format? If so do you know which field? It appears that Plex uses its own internal management system for the groups that it displays based on using the HDHomerun/Plex EPG data.
Just popping in to say thank you @sixxnet ! I was using xteve → plex and had no idea about TVH. Adding that to the workflow has made things a lot smoother even though i don’t quite know why.
Next, i will give the spawn profile a go but its working pretty well even without the modded docker image
You’ll find if you have multiple sources for a channel that when tuning TVheadend will choose them in the same order every time. Another thing you may run into if you have multiple sources for a channel is when the stream dies and TVheadend goes to switch that your video/audio will get choppy. This usually happens when the audio is different than the first which will cause the playback to get out of sync/choppy.
The spawn profile solves this by transcoding the audio to one format on the fly thus solving the syncing issue.
Other than that the only thing my mod does is enable TVheadend to choose a channel source at random and tweaks a couple hard-coded timeout values.
You can view the actual code to my mods here:
My docker container also integrates streamlink into the image. You can compile everything manually using this if you don’t trust my image as-is:
Decided to take the plunge last night and move to your mod. All was well until this morning the container keeps restarting - not sure why. But i will probably figure that out.
TVH itself does have a bit of a learning curve to it and i’ve been doing ok with their Wiki however, i just cant seem to get to grips with Muxes / Services, Channels and how to pull it altogether.
Also, how does one merge similar sources (SD, HD variant for example) to one channel?
Do you have a wiki of your own that could help me to get to the same Nirvana you’re in?
daorriss was having the container rebooting problem when he pressed “Force Scan” on an added network via m3u. The correct way to refresh your m3u is to set the Re-fetch period in the network settings. Maybe this is the same issue…
Once you import a m3u file there is really no need to mess with the Muxes tab. What you need to do is set everything up from the Services tab instead. After you manually create your channel in the Channels tab you can go back to Services and assign each one to the corrosponding channel using the “Channel” drop down.