Channels DVR Server in docker setup

I want to spin up a test dvr server in a container. The host machine already has channels running on it. Linux Ubuntu desktop with docker and portainer installed. I have other containers running and all is well but they don’t have large storage requirements like a dvr.

My question stems on storage and docker compose layout. I have multiple drives attached and I would like the dvr software to run on the host os drive but I want the recordings stored at a different drive. lets say the path to that drive is
/mnt/blaablaablaa/piggy

What do I need to change create or whatever to accomplish this. Or don’t change anything and I’ll just be able to choose that location in the dvr setup. Here is the compose I’m starting with.

channels-dvr:
  image: fancybits/channels-dvr:tve
  container_name: channels-dvr
  network_mode: host
  ports:
    - "8088:8089"
  restart: on-failure:10
  devices:
    - /dev/dri:/dev/dri
  volumes:
    - /mnt/disk/dvr/config:/channels-dvr
    - /mnt/disk/dvr/recordings:/shares/DVR

The first line under volumes defines where the data related to the channels dvr executable is stored. With the value to the right of the colon being the location inside the container (don't change this), and the value to left being a binding to a directory on the host computer to make this data persistent through reboots and the like.

The second line under volumes defines where the dvr recordings will be stored, and the value to the right of the colon can pretty much be anything you want (but whatever you choose is the path you need to use when you're setting up Channels). In other words, as far as Channels is concerned this is the path to your recordings.

However, this is also a directory binding, so the value to the left of the colon is the actual location on the host computer where your recordings will be stored. For convenience, some will use the same path inside the container as they're using on the host to minimize confusion.

Here's the Docker Compose I'd recommend as a starting point:

version: '3.9'
services:
  # 2024.09.15
  # Docker Hub home for this project: https://hub.docker.com/r/fancybits/channels-dvr
  channels-dvr:
    image: fancybits/channels-dvr:${TAG}
    container_name: channels-dvr
    #devices:
      #- /dev/dri:/dev/dri
    ports:
      - ${HOST_PORT}:${CHANNELS_PORT}
    environment:
      - CHANNELS_PORT=${CHANNELS_PORT}
      - TZ=${TZ}
    volumes:
      - ${HOST_DIR}/channels-dvr:/channels-dvr
      - ${DVR_SHARE}:${DVR_CONTAINER_DIR}
    #network_mode: host
    restart: unless-stopped
#volumes: # use this section if you've setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /channels-dvr inside the container
  #channels-dvr:
    #external: ${VOL_EXTERNAL}
    #name: ${VOL_NAME}

With these sample env vars:

TAG=tve
HOST_PORT=8089
CHANNELS_PORT=8089
TZ=America/Denver
HOST_DIR=/data
DVR_SHARE=/mnt/dvr
DVR_CONTAINER_DIR=/shares/DVR
1 Like

Thanks so much for the explanation. So if I’m understanding correctly all I really need to change is the bottom volume like so with these variables

TAG=tve
HOST_PORT=8088 (8089 in use on host)
CHANNELS_PORT=8089
TZ=America/Denver
HOST_DIR=/data
DVR_SHARE=/mnt/blaablaablaa/piggy
DVR_CONTAINER_DIR=/shares/DVR

And when running the actual dvr setup my storage path drill down will be /shares/DVR.
Correct?

That should work!

1 Like

A couple notes
If you want to enable hardware transcoding, uncomment these two lines

    #devices:
      #- /dev/dri:/dev/dri

If you need to run the container in host network mode, uncomment this line

    #network_mode: host

and change the env var CHANNELS_PORT=8089 to CHANNELS_PORT=8088

1 Like

Great points. I’m up and running. Thank you both for the help.

1 Like

I'm up and running with a similar docker compose YAML file. I've got a HL15 from 45Drives running TrueNAS Electric Eel and I'm running Channels DVR Server via Docker Compose in Dockge.

I was able to get the server running and was able to map all the content I had on my old Channels server running on my Mac to the new server.

Everything I imported that I previously recorded plays back. The issue I'm running into is if I record a show now, it will playback from the macOS Finder, the iOS App, and from the Channels DVR web UI but if I attempt to play the video back on the Apple TV app it doesn't playback. It just presents the last frame of video as a still image for about 1-2 seconds and then goes back to the menu as if it completed playback.

Any ideas on what I could be doing wrong?

Here's an excerpt from my log:

2024/10/30 16:02:47.552438 [ENC] Starting encoder for CI Living 2011-09-12 2024-10-30-1523.mpg in /channels-dvr/Streaming/file11787-ip192.168.9.155-3399363636/encoder-10-2747985522 at 10 (10.832599) (encoder=libx264, codec=h264, acodec=aac, resolution=1080, deinterlacer=blend, bitrate=9488, segment_size=0.01)
2024/10/30 16:02:47.571495 [HLS] ffmpeg: file11787-ip192.168.9.155: [mpegts @ 0x8635900] Packet corrupt (stream = 1, dts = 3358060036), dropping it.

1 Like

Does it play if you set the ATV app, settings >playback > streaming quality to original?

In what situation would this be needed?

If your docker distribution is affected by the Channels security fix ⚠️ Security Resolution Incoming ⚠️

1 Like

Thank You for all the responses and suggestions. Embarrassingly enough, I resolved the issue by uninstalling Channels DVR from my Apple TV and reinstalling it. Not sure why that fixed it but it did. I did not change any settings in the Apple TV app. I greatly appreciate everyones input and time on this.

2 Likes