Channels DVR: Remapping Channel Numbers

  • Post author:
  • Post category:Home Projects
  • Post last modified:December 5, 2020
  • Reading time:8 mins read

We’ve been using Channels DVR to allow us to record and pause/rewind/fast forward live TV associated with our Locast, AT&T TV Now and Philo streaming accounts for the past two years.

The one thing we weren’t really happy with was the numbering scheme that Channels uses. I had hoped to be able to re-map the channel numbers to something I’m more familiar with, notably the DirecTV numbering scheme (to match our AT&T TV Now account).

The Channels developers are greatly responsive to customer suggestions. They let me know that channel mapping was on their roadmap, but not any time soon. That led me to look for (or potentially write my own) solutions.

PHP to the Rescue

To solve this, I ended up writing my own PHP application to take the Channels DVR streams as an input, change the channel numbers, and send them out as a M3U playlist.

The kicker: Channels DVR also has the ability to use a M3U playlist as a source. The output from my channel mapping application can then be fed back into Channels with the new channel numbers.

Docker Keeps Everything Organized

Channels DVR provides their own Docker image that can be used to run the actual DVR server. I’ve been using it for the whole time I’ve been running Channels, so that’s nothing new to me. The idea I had was to use that Docker image to create two separate instances of Channels running on the same server.

Multiple Channels DVR Instances For The Win

The first one (or back end) would take my sources (Locast, AT&T TV Now, and Philo) and pull all the streams together into one place. This is the beauty of Channels DVR.

My PHP application would then take the output from that back end instance, apply the new channel numbers to it, and output those streams and channel numbers as a new M3U playlist. That new playlist can then be used as an input for the second (front end) instance of Channels DVR. All clients will connect to that front end instance. The back end is only there to provide the streams to the front end.

Putting it All Together

I created an easy to use Docker Compose setup to allow anyone who wants to use this to do so as easily as possible. This guide assumes a working Linux system with both Docker and Docker Compose installed.

NOTE: You can likely adapt this to work on a Windows system. For those of you using Windows, the $ in the command above (and in all of the following commands) is just the Linux prompt. Everything following is the command. I’ve modified the post to change the color of the prompt in all instances below, to avoid confusion.

You’ll likely need to adapt some of these commands to Windows to make this work.

We’ll start in the user’s home directory.

$ cd ~

Setting Up Docker Compose

First things first: clone the Docker Compose code to your server, and initialize the directory structure we’ll need to make this all work. We will clone the necessary Docker Compose files from my GitHub repository.

$ git clone https://github.com/crackers8199/channels-dvr-mapper-docker.git
$ cd ~/channels-dvr-mapper-docker
$ sh dir_init.sh

Clone the Channels DVR Mapping Application

Now we’ll bring the channel mapping code into the fold:

$ cd ~/channels-dvr-mapper-docker
$ git clone https://github.com/crackers8199/channels-dvr-mapper.git

There are a few changes we’ll need to make in order to get the app ready to run:

$ cd ~/channels-dvr-mapper-docker/channels-dvr-mapper
$ cp .env.channels .env

Add the Necessary Environment Variables

At this point, we’ll need to modify the .env file we just created. Open your favorite text editor, and at the bottom of the .env file modify the CHANNELS_BACKEND_IP variable by changing the x.x.x.x to your server’s IP address. That’s all you should need to change in order to get this ready to run.

Build the Containers

We’re ready to build the Docker containers that will set this entire thing into motion:

$ cd ~/channels-dvr-mapper-docker
$ docker-compose up --build -d

Go use the bathroom and maybe get yourself a snack or a cup of coffee. You’ll need to give the containers a few minutes to build and get themselves up and running.

Make Sure Everything is Working

Open your web browser, and go to http://<server ip> in your browser. You should see the following screen:

channels dvr mapper initial screen

If you don’t see this screen (or if you see an error message), the containers might not be built yet. Give it a minute or two, then refresh the browser.

Channels DVR Back-End Setup

From the screen above, you should be able to click the link to your back end web UI and proceed with adding your sources to the back end. There is something you’ll need to watch out for here, though.

When logging into Channels, sometimes the setup process gets confused by the Docker bridge network. I haven’t yet figured out why this only happens some of the time, but not always – but there’s a workaround. This guide will assume you are using Chrome for this next part. There may be ways to do this in other browsers, but I’m not familiar enough to explain them here.

If you get stuck when you click Log In on the Channels DVR setup page, you can get around it by doing the following:

Channels DVR Setup Workaround

In Chrome, open up developer tools.

chrome browser open developer tools

When you click the Log In button, watch the network traffic in the dev tools. Look for the auth/confirm URL that will get stuck in a pending state, and copy the link address.

channels dvr setup initial screen with dev tools

copy link address for channels dvr login confirmation

Paste that link into your browser’s address bar, and change the IP address and port number to the IP address of your server, and port 8090.

modify ip address for channels dvr login confirmation

Once you do that, you should end up with the familiar screen below. You can see that in this instance, my server’s IP address is 192.168.88.167.

channels dvr settings page

Add Your Sources

At this point, you can add your sources here. In my case, I’ll add our AT&T TV Now and Philo TVE accounts. Channels DVR has since added an option to allow Locast to use the OTA channel numbers, which is the channel numbering scheme I want – so I’ll simply add that in the front end later.

You can also disable Bonjour and Commercial Skip in the back end, as they’re not needed here. This instance won’t do anything other than provide the streams to the channel mapper and the front end, so we won’t need to connect to it from any clients or have it skip any commercials (as it won’t be recording anything).

Map Your Channels

Now, go back to that same http://<server ip> page we went to when we verified the initial setup. You should now see that a new menu option has appeared at the top of the page to allow you to choose from your back end sources. Select one and work on your channel map!

channel mapping available sources
channel mapping UI

You’ll notice at the top of the screen, there’s a new menu option for the current source. Expand that drop-down menu. You’ll see the ability to view the M3U playlist as well as an XMLTV formatted program guide. We won’t be using the XMLTV guide (channels will auto map the guide for us), but it’s there if you want to use it for any other purpose.

Keep this menu in mind for when you’re adding your sources in the next step. You can copy the link to your playlist and paste it in the source select screen.

Channels DVR Front End Setup

Once you’re satisfied with your channel map, you’re ready to add your sources to the Channels DVR front end instance. This is the instance that will use the default port (8089), and all of your clients will connect to this instance. Instead of adding traditional Channels sources here, you’re going to use their new Custom M3U source to read the playlists the mapper application will have created.

channels dvr choose a source

The options for the M3U playlist will look like this:

channels dvr m3u playlist options

You can name the source whatever you like (I use channels backend <source name>, to keep things simple).

The stream format should always be MPEG-TS when using sources from the Channels back end.

The source is URL, and the actual URL is the link you copied above from the drop-down menu.

The other options can be changed as you see fit, but you always will want to prefer the channel number from the M3U. Turning that off would defeat the entire purpose of this exercise!

Step 9,273,498,356: Profit

I know this has been a really long and arduous process getting this working, but now you can configure your clients to connect to this Channels DVR server as you normally would. If everything was set up correctly, you should now see all of your channels with the channel map you defined earlier.

channels dvr web guide with remapped channel numbers

Enjoy! If you enjoyed this tutorial, feel free to check out some of our other tech projects!

5 1 vote
Article Rating
Subscribe
Notify of
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
William Hunter
William Hunter
1 month ago

hey Matt seeing if the channels dvr server can be installed on a remote server. I got slow slow bandwidth at home. was hoping to get a ups and install it on there. I use to do that a long time ago. seeing if you can help thanks