Project

General

Profile

Add youtube channel to TvHeadend 4.2.1-7

Added by Harold Hehinger over 7 years ago

I am setting up a youtube channel (NASA TV) in TvHeadend.

When I take the URL comming from youtube-dl f 95 https://www.youtube.com/watch?v=Fih5Wpe6ac4 -g and paste it in mux -> URL as pipe:///usr/bin/ffmpeg -i <URL I have> -vcodec copy -acodec copy -f mpegts -tune zerolatency pipe:1 it works.

After a few hours, it appears the link expires. I wrote the following bash script:

#!/bin/bash
zsite=$(youtube-dl -f 95 https://www.youtube.com/watch?v=Fih5Wpe6ac4 -g)
/usr/bin/ffmpeg -i $zsite -vcodec copy -acodec copy -f mpegts -tune zerolatency pipe:1

and changed mux --> URL to pipe:///home/tv/Documents/NASA_TV.sh

When I access the channel, the Channel does not work. The LOG records:
2017-04-27 15:49:08.440 htsp: Got connection from 127.0.0.1
2017-04-27 15:49:08.441 htsp: 127.0.0.1: Welcomed client software: Kodi Media Center (HTSPv25)
2017-04-27 15:49:08.442 htsp: 127.0.0.1 [ Kodi Media Center ]: Identified as user 'TvLand'
2017-04-27 15:49:08.442 htsp: 127.0.0.1 [ TvLand | Kodi Media Center ]: Privileges updated
2017-04-27 15:49:15.892 mpegts: NASA TV in Test IP - tuning on IPTV
2017-04-27 15:49:15.893 subscription: 0002: "127.0.0.1 [ TvLand | Kodi Media Center ]" subscribing on channel "Nasa_TV", weight: 150, adapter: "IPTV", network: "Test IP", mux: "NASA TV", provider: "FFmpeg", service: "Service01", profile="htsp", hostname="127.0.0.1", username="127.0.0.1", client="Kodi Media Center"
2017-04-27 15:49:15.895 spawn: Executing "/home/tv/Documents/NASA_TV.sh"
2017-04-27 15:49:15.897 iptv: stdin pipe unexpectedly closed: No data
2017-04-27 15:49:31.893 subscription: 0002: service instance is bad, reason: No input detected
2017-04-27 15:49:33.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:35.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:37.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:39.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:41.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:43.893 subscription: 0002: No input source available for subscription "127.0.0.1 [ TvLand | Kodi Media Center ]" to channel "Nasa_TV"
2017-04-27 15:49:44.104 subscription: 0002: "127.0.0.1 [ TvLand | Kodi Media Center ]" unsubscribing from "Nasa_TV", hostname="127.0.0.1", username="127.0.0.1", client="Kodi Media Center"
2017-04-27 15:49:46.071 htsp: 127.0.0.1 [ TvLand | Kodi Media Center ]: Disconnected

Any suggestions how to do this?

Thanks for all your help in advance.


Replies (5)

RE: Add youtube channel to TvHeadend 4.2.1-7 - Added by Robert Cameron over 7 years ago

Try quoting your variables: instead of -i $zsite, try -i "${zsite}".

Also, you can simplify your ffmpeg command:
ffmpeg -i "${zsite}" -c copy -f mpegts pipe:1

The -c option applies to all streams, and the -tune zerolatency option is for encoding with libx264, which is not being used if you are merely passing the stream.

RE: Add youtube channel to TvHeadend 4.2.1-7 - Added by Harold Hehinger over 7 years ago

I tried that, and I am getting the same errors.

I also tried using changing my script to the specific link from youtube-dl, indicating to me the script is not the problem, but the way I am referencing the file in TV_Headend.

Is my reference to the script as "file:///home/tv/Documents/NASA_TV.sh" correct...?

RE: Add youtube channel to TvHeadend 4.2.1-7 - Added by Harold Hehinger over 7 years ago

I tried livestreamer and now I get a signal, but it appears to start at the beginning of the stream about 1 year ago with no audio. I used:
pipe:///usr/bin/livestreamer https://www.youtube.com/watch?v=Fih5Wpe6ac4 720p --stdout

While adjusting the resolution, I once got the 'live' feed, but no audio. After adjusting the resolution to one of the others, and changed it back to 720p, I start at the beginning.

The log entry for using the 'best' option is below (This time gave me the live feed without audio):

2017-05-08 15:31:32.227 mpegts: NASA TV in Test IP - tuning on IPTV
2017-05-08 15:31:32.228 subscription: 0031: "172.20.5.153 [ TvLand | Kodi Media Center ]" subscribing on channel "Nasa_TV", weight: 150, adapter: "IPTV", network: "Test IP", mux: "NASA TV", provider: "FFmpeg", service: "Service01", profile="htsp", hostname="172.20.5.153", username="172.20.5.153", client="Kodi Media Center"
2017-05-08 15:31:32.230 spawn: Executing "/usr/bin/livestreamer"
2017-05-08 15:31:32.521 spawn: [cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=Fih5Wpe6ac4
2017-05-08 15:31:32.830 spawn: [cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p (best)
2017-05-08 15:31:32.830 spawn: [cli][info] Opening stream: 720p (hls)
2017-05-08 15:31:33.729 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = -18000, last = 429360
2017-05-08 15:31:33.729 tsfix: transport stream H264, DTS discontinuity. DTS = -18000, last = 432000
2017-05-08 15:31:34.000 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = -18000, last = 431280
2017-05-08 15:31:34.000 tsfix: transport stream H264, DTS discontinuity. DTS = -18000, last = 432000
2017-05-08 15:31:38.653 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = -18000, last = 429360
2017-05-08 15:31:38.654 tsfix: transport stream H264, DTS discontinuity. DTS = -18000, last = 432000
2017-05-08 15:31:42.180 subscription: 0031: "172.20.5.153 [ TvLand | Kodi Media Center ]" unsubscribing from "Nasa_TV", hostname="172.20.5.153", username="172.20.5.153", client="Kodi Media Center"
2017-05-08 15:37:46.436 mpegts: NASA TV in Test IP - tuning on IPTV
2017-05-08 15:37:46.439 subscription: 0032: "172.20.5.153 [ TvLand | Kodi Media Center ]" subscribing on channel "Nasa_TV", weight: 150, adapter: "IPTV", network: "Test IP", mux: "NASA TV", provider: "FFmpeg", service: "Service01", profile="htsp", hostname="172.20.5.153", username="172.20.5.153", client="Kodi Media Center"
2017-05-08 15:37:46.441 spawn: Executing "/usr/bin/livestreamer"
2017-05-08 15:37:46.762 spawn: [cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=Fih5Wpe6ac4
2017-05-08 15:37:47.072 spawn: [cli][info] Available streams: 144p (worst), 240p, 360p, 480p, 720p (best)
2017-05-08 15:37:47.072 spawn: [cli][info] Opening stream: 720p (hls)
2017-05-08 15:37:48.105 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = 0, last = 449280
2017-05-08 15:37:48.106 tsfix: transport stream H264, DTS discontinuity. DTS = 0, last = 450000
2017-05-08 15:37:48.373 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = 0, last = 447360
2017-05-08 15:37:48.373 tsfix: transport stream H264, DTS discontinuity. DTS = 0, last = 450000
2017-05-08 15:37:53.314 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = 0, last = 449280
2017-05-08 15:37:53.315 tsfix: transport stream H264, DTS discontinuity. DTS = 0, last = 450000
2017-05-08 15:37:58.664 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = 0, last = 447360
2017-05-08 15:37:58.664 tsfix: transport stream H264, DTS discontinuity. DTS = 0, last = 450000
2017-05-08 15:38:03.838 tsfix: transport stream AAC-LATM, DTS discontinuity. DTS = 0, last = 445440

Any suggestions..?

Thanks.

RE: Add youtube channel to TvHeadend 4.2.1-7 - Added by Harold Hehinger over 7 years ago

Figured it out. The URL I was using loops videos and contains no audio. I used a different link, and I get audio and video.

    (1-5/5)