Closed gkovacsp closed 2 years ago
what pipe:// command are you using in the Tvheadend's url field? your log indicates that it can find streamlink and streamlink is able to find the youtube live stream but Tvheadend is not detecting any incoming data from streamlink. remember that streamlink must output to stdout (--stdout).
pipe:///usr/bin/env streamlink --stdout --default-stream best --url https://www.youtube.com/watch?v=gxG3pdKvlIs
Using
streamlink --stdout --default-stream best --url https://www.youtube.com/watch?v=gxG3pdKvlIs
on the command line will fill the terminal with garbage from the stream
which Docker container are you using and arch (arm, amd, etc.)? did you install streamlink via my script? I'll take a look at it over the weekend...
Raspberry Pi4 8GB Raspberry Pi OS 64b (latest) docker image: linuxserver/tvheadend I use your script to install streamlink, startup logs shows it is installed, from ssh+cli it works like charm
I've tried with a brand new container from scratch, same result.
My docker compose:
version: "3.4"
services:
tvheadend_stream:
image: linuxserver/tvheadend
container_name: tv-headend-stream
restart: unless-stopped
ports:
- 9991:9981
- 9992:9982
volumes:
- /home/pi/docker-data/tvheadend-stream:/config
environment:
- PUID=1000
- PGID=1001
- TZ=Europe/Budapest
# container specific
- RUN_OPTS=--http_root /t/tvheadend-stream/ --noacl
cap_add:
- NET_ADMIN
Pipe
pipe:///usr/bin/env streamlink --stdout --default-stream best --url https://www.youtube.com/watch?v=gxG3pdKvlIs
tvheadend log
2022-09-23 16:01:38.283 bouquet: new bouquet 'Streamlink'
Loglevel debug: enabled
2022-09-23 16:03:15.410 mpegts: Streamlink - France 24 in Streamlink - tuning on IPTV #1
2022-09-23 16:03:15.412 spawn: Executing "/usr/bin/env"
2022-09-23 16:03:15.412 epggrab: Streamlink - France 24 in Streamlink - registering mux for OTA EPG
2022-09-23 16:03:15.413 subscription: 0001: "scan" subscribing to mux "Streamlink - France 24", weight: 5, adapter: "IPTV #1", network: "Streamlink", service: "Raw PID Subscription"
2022-09-23 16:03:18.478 spawn: [cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=gxG3pdKvlIs
2022-09-23 16:03:28.123 spawn: [cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)
2022-09-23 16:03:28.124 spawn: [cli][info] Opening stream: 1080p (hls)
2022-09-23 16:03:30.410 mpegts: Streamlink - France 24 in Streamlink - scan no data, failed
2022-09-23 16:03:30.410 subscription: 0001: "scan" unsubscribing
service: "Raw PID Subscription"
how are you testing the stream from Tvheadend? I think you are trying to play directly from the mux (raw) but that has never worked for me. instead, try using a standard client (e.g., Kodi) or the built-in player (EPG > Watch TV).
Same happens if I play a channel through a channel link
2022-09-24 19:07:23.687 subscription: 00AE: "HTTP" subscribing on channel "F24 - pipe", weight: 100, adapter: "IPTV #1", network: "Streamlink", mux: "F24 - pipe", service: "F24 - pipe", profile="plex", hostname="172.22.0.1", username="xxx", client="VLC/3.0.17.3 LibVLC/3.0.17.3"
2022-09-24 19:07:23.687 spawn: Executing "/usr/bin/ffmpeg"
2022-09-24 19:07:26.763 spawn: [cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=gxG3pdKvlIs
2022-09-24 19:07:36.325 spawn: [cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)
2022-09-24 19:07:36.325 spawn: [cli][info] Opening stream: 720p (hls)
2022-09-24 19:07:39.681 subscription: 00AE: service instance is bad, reason: No input detected
2022-09-24 19:07:41.681 subscription: 00AE: No input source available for subscription "HTTP" to channel "F24 - pipe"
2022-09-24 19:07:41.681 webui: Couldn't start streaming /t/tvheadend/stream/channel/0463730ea268607b3e67a61e1ece5d84?ticket=615c9ecff9db354f00e66cad7e65242ccbfb0bb0, No input detected
2022-09-24 19:07:41.681 subscription: 00AE: "HTTP" unsubscribing from "F24 - pipe", hostname="172.22.0.1", username="xxx", client="VLC/3.0.17.3 LibVLC/3.0.17.3"
As a workaround I've created a container and started streamlink processes for the channels I'm interested in. Then I use a http:// link in tvheadend to point to the right port of the other container. This way it works well.
This is the bash file I run in the container after it starts:
# cnews
echo "cnews: 2230"
/usr/local/bin/streamlink \
--player-continuous-http \
--player-external-http-port 2230 \
--player-external-http \
https://www.dailymotion.com/video/x3b68jn \
720p,best \
&
# france 24
echo "france24: 2231"
/usr/local/bin/streamlink \
--player-continuous-http \
--player-external-http-port 2231 \
--player-external-http \
https://www.youtube.com/watch?v=gxG3pdKvlIs \
720p,best \
&
# bfm tv
echo "bfm tv: 2232"
/usr/local/bin/streamlink \
--player-continuous-http \
--player-external-http-port 2232 \
--player-external-http \
https://www.bfmtv.com/en-direct/ \
720p,best \
&
# gulli
echo "gulli: 2233"
/usr/local/bin/streamlink \
--player-continuous-http \
--player-external-http-port 2233 \
--player-external-http \
https://replay.gulli.fr/Direct/ \
720p,best \
&
# euronews
echo "euronews: 2234"
/usr/local/bin/streamlink \
--player-continuous-http \
--player-external-http-port 2234 \
--player-external-http \
https://www.youtube.com/watch?v=NiRIbKwAejk \
720p,best \
&
while true; do sleep 100; done
This is the simple URL I use with it in tvheadend
http://192.168.1.95:2234
well, I'm not entirely sure what is going on with your container because I cannot reproduce this issue with my own hosts.
As a workaround I've created a container and started streamlink processes for the channels I'm interested in. Then I use a http:// link in tvheadend to point to the right port of the other container. This way it works well.
interesting. I never thought about that. I guess the drawback is that the channels are always running in the background and if the connection breaks, it won't restart until you run the script again. (of note, instead of https://www.youtube.com/watch?v=gxG3pdKvlIs
, it is more reliable to point to the channel's url, https://www.youtube.com/c/FRANCE24
, because the exact live stream url, watch?v=
, might change for multiple reasons.)
as a last resort, you might want to switch pipe:///usr/bin/env streamlink
for pipe:///usr/bin/streamlink
because env
might be doing somethin unexpected with stdout
that does not let Tvheadend to detect it.
also, I wrote a helper script for Tvheadend that lets you add multiple URLs to the pipe://
command (https://github.com/cgomesu/tvhlink/blob/master/tools/tvhlink.sh). you might want to give it a try for a single URL and see if it runs when the script executes streamlink
instead. the advantage of doing this is that streamlink is executed only when a Tvheadend client wants to watch the channel and if the connection breaks, the client can try again and the script will be executed again, too. here's an example of pipe cmd that uses such a script (assuming Tvheadend can find the script at /config/tools/tvhlink.sh
):
pipe:///bin/sh /config/tools/tvhlink.sh "https://www.youtube.com/c/FRANCE24"
Thanks for all the tips, skipping env
did not help, neither using the tvhlink.sh
script.
There is no need to re-run the script if the stream breaks, it is enough to switch a channel back and forth. Still, it would be better if it had fixed itself. Luckily, 4 of the 5 streams are stable, no issues.
I was not sure if streamlink is continuously streaming the channels in the separate container, even when no one is watching them. I've checked and it only starts them when a client connects to the published port. So this extra container is very lightweight.
The separate container has one advantage: The tvheadend container updates itself in seconds, no need to wait for 2-3 minutes of post start script install process of streamlink.
I was not sure if streamlink is continuously streaming the channels in the separate container, even when no one is watching them. I've checked and it only starts them when a client connects to the published port. So this extra container is very lightweight.
The separate container has one advantage: The tvheadend container updates itself in seconds, no need to wait for 2-3 minutes of post start script install process of streamlink.
nice to learn about this option. I'll play around with it because it sounds pretty good. thanks for sharing your solution. I'll go ahead and close this issue now.
I have followed the instructions from here:https://cgomesu.com/blog/Tvhlink/#single-livestream-channel
Got everything installed, things seem to be fine until the test runs:
If I ssh into the tvheadend container and enter this command, then the stream is correctly captured into the desired file:
Info about my install
I must be so close to a working setup, what could be the problem?