Jellyfin Forum
Trouble with TVHeadEnd plugin - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Trouble with TVHeadEnd plugin (/t-trouble-with-tvheadend-plugin)

Pages: 1 2


Trouble with TVHeadEnd plugin - whimbrel - 2025-01-26

Hi everyone -

I have an existing Jellyfin installation in a docker container on my NAS, which has been up for about a month and is working great.

I just got a TV antenna connected to an HDHomeRun device, and set up TVHeadEnd in another docker image on the same NAS device. This setup seems to be working just fine - I have the TVHeadEnd plugin in Kodi and I can watch live TV and set recordings.

Now I'm trying to get the Jellyfin plugin for TVHeadEnd working, and am running into problems I have followed this guide to set the jellyfin user in TVHeadEnd, triple checked that I used all the right settings. I have the TVHeadEnd plugin enabled in Jellyfin, with the server set to 127.0.0.1, and the right login info. But it doesn't work. It looks like Jellyfin is repeatedly failing to log into TVHeadEnd, the Jellyfin interface shows a spinning wheel every few seconds but the Live TV panel shows 0 shows/0 channels.

The Jellyfin logs show these same two errors recurring every few seconds:

Code:
2025-01-25 15:58:24.826 -08:00] [ERR] [21] TVHeadEnd.HTSP.HTSConnectionAsync: [TVHclient] HTSConnectionAsync.open: exception caught
System.Net.Sockets.SocketException (111): Connection refused [::1]:9982
  at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
  at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
  at TVHeadEnd.HTSP.HTSConnectionAsync.open(String hostname, Int32 port)
[2025-01-25 15:58:25.086 -08:00] [ERR] [53] TVHeadEnd.HTSP.HTSConnectionAsync: [TVHclient] HTSConnectionAsync.open: exception caught
System.Net.Sockets.SocketException (111): Connection refused [::1]:9982
  at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
  at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
  at TVHeadEnd.HTSP.HTSConnectionAsync.open(String hostname, Int32 port)

So it can't connect to the HTSC service. I've double checked that my TVHeadEnd instance is using the default port (9982), and I know it's working because the TVH admin panel shows Kodi connected to HTSC. So, what's going on here?

Jellyfin version: 10.10.3
TVHeadEnd version: 4.3-2375~g653bd0400
TVHeadEnd plugin version: 12.0.0.0

One further test: to make sure the two docker containers can talk to each other, I logged into the jellyfin container and pinged the TVHeadEnd HSTC port by running curl 127.0.0.1:9982.

When I do so, I see it pop up in the TVHeadEnd log:


2025-01-25 16:03:23.123 htsp: Got connection from 127.0.0.1
2025-01-25 16:03:23.123 htsp: 127.0.0.1: Disconnected


So I'm convinced it's not just a networking problem. What's strange is that I am NOT seeing anything in the TVHeadEnd log when Jellyfin itself tries to connect. The pair of errors in my original post appear in the Jellyfin log about once a second, but I don't see anything appearing in the TVHeadEnd log.


RE: Trouble with TVHeadEnd plugin - TheDreadPirate - 2025-01-26

Unless both containers are running with host networking, 127.0.0.1 wouldn't work. If either is running with bridge networking you'd need to use the actual IP of either the container or the host.

Can you provide the docker compose for both Jellyfin and TVH?


RE: Trouble with TVHeadEnd plugin - whimbrel - 2025-01-26

Thanks TheDreadPirate! Both containers are using host networking.

The TVH compose file is:
Code:
---
services:
  tvheadend:
    image: lscr.io/linuxserver/tvheadend:latest
    # ghcr.io/tvheadend/tvheadend:latest
    container_name: tvheadend
    #user: 1003:100
    group_add:
      - "100"
      - "1003"
    # We need host network to access hdhomerun
    network_mode: 'host'
    environment:
      # This is the tvheadend user I created
      - PUID=1003
      - PGID=100
      #- TZ=Etc/UTC
      - TZ=America/Los_Angeles
      - RUN_OPTS= #optional
    volumes:
      - ${TVHEADEND_CONFIG_DIR}:/config
      - CHANGE_TO_COMPOSE_DATA_PATH/tvheadend_recordings:/recordings
    restart: unless-stopped

And the Jellyfin one is:

Code:
---
# https://hub.docker.com/r/linuxserver/jellyfin
services:
  jellyfin:
    image: jellyfin/jellyfin
    container_name: jellyfin
    user: 1002:100
    network_mode: 'host'
    group_add:
      - "105"
    environment:
      - PUID=1002
      - PGID=100
      - TZ=America/Los_Angeles
    volumes:
      - ${JELLYFIN_CONFIG_DIR}/config/:/config
      - ${JELLYFIN_CONFIG_DIR}/cache/:/cache
      - CHANGE_TO_COMPOSE_DATA_PATH/Movies:/data/Movies
      - CHANGE_TO_COMPOSE_DATA_PATH/TV:/data/TV
      - CHANGE_TO_COMPOSE_DATA_PATH/jellyfin_library/:/data/library
    ports:
      - 8096:8096
      - 8920:8920 #optional
      - 7359:7359/udp #optional
      - 1900:1900/udp #optional
    devices:
      - /dev/dri:/dev/dri
    restart: unless-stopped

The 1002 and 1003 user ids correspond to jellyfin and tvheadend, respectively.


RE: Trouble with TVHeadEnd plugin - whimbrel - 2025-01-26

Ope, I deleted the ports section in the jellyfin config and it seems to connect now! I guess that was overriding the host network setting.

But I'm still having trouble: Jellyfin only shows TVH recordings and not live TV, and it can't even play the recordings. When I request to play a recording, it spins forever and does not seem to load the video.

It clearly does *something*, I see the GPU I use for transcoding fire up, and Jellyfin's logs show an FFMpeg transcoding event where it generates a million tiny files in /cache/transcodes (all named stuff like 9ee4163b2f07756e744dd6d3d5d4ba2c441.mp4). The main Jellyfin log shows ffmpeg exits with code 0, so I'm not sure what the problem is.


RE: Trouble with TVHeadEnd plugin - TheDreadPirate - 2025-01-27

Can you share your full jellyfin log via privatebin.net? And any ffmpeg logs it generated.


RE: Trouble with TVHeadEnd plugin - whimbrel - 2025-01-27

Absolutely

Here is the transcode log when I play a recording: https://privatebin.net/?18f011e1b33af6ac#6u6f7AYAStkt1FmgZAJb3jDqes5EULsaQqcbDzXTFWh7
Here is the transcode log when I try to play live TV: https://privatebin.net/?0a1349a190d9f6df#E5gJ5ccr667o92jnAwtp7gfFiZnmhG2BXs7TXr7qcepo

And here is the relevant portion of the jellyfin daily log: https://privatebin.net/?5d9f49938d7b7e9c#H3SCyqEQKk9gZpQCmsGYhvUBdoBYZQG3opZmQRRRjZey


RE: Trouble with TVHeadEnd plugin - whimbrel - 2025-01-27

I'll note that, when trying to play a recording, there is a huge spike in CPU usage from ffmpeg. So clearly it is doing a lot of work on some remuxing or transcoding. But even once that finishes, the jellyfin client just keeps spinning and spinning and it doesn't play. I'm currently testing with a client logged in through Firefox, but it's the same behavior with the Jellyfin client on an iPad.


RE: Trouble with TVHeadEnd plugin - gnattu - 2025-01-27

I think it is yet another case where livetv does not work with hardware acceleration. Can you change the acceleration type to none to see if the stream plays in that case? (Note you'd better have a fast enough CPU
)


RE: Trouble with TVHeadEnd plugin - whimbrel - 2025-01-27

Disabling hardware enconding doesn't seem to fix anything. It's definitely not using the GPU anymore, and it's not transcoding as fast (~2.5x speed instead of 8x speed). But in the client, I just see it spinning and spinning and the video never starts playing, even after the transcoding is complete.


RE: Trouble with TVHeadEnd plugin - TheDreadPirate - 2025-01-27

I'm pretty sure you can configure TVH to pre-transcode before sending to Jellyfin. Give that a try?