BETA: Chrome Capture for Channels

Is there an easy way to either send a keystroke or refresh the browser when it hits the 4-hour mark? I have events like the British Open on USA network that go way longer than 4 hours but that's the max you can have on an NBC session. All I need to do is stop and restart the capture or send a keystroke to refresh it.

Is there a step by step guide on how to set this up? I am on my custom channel section and I have entered all my information in such as my source, name and left the options as the default but I am not sure what to put under XMLTV Guide data.

I didn't enter anything in mine and pulling guide data fine for BYUtv. Just map to the proper Grace note channel ID.

1 Like
1 Like

Question - If you're deploying this via Portainer Stacks, how are you making the changes to Main.json? I just created the stack on mine (from the original instructions) and deployed that, which downloaded the image and runs the container.

@scottuf @ajmoore88

I've been playing around with this a bit this morning, and I believe this compose would work well to make the "viewport" configurable through environment variables, and replace the default "args" list with one of your choosing:

version: '3.9'
services:
  cc4c:
    image: fancybits/chrome-capture-for-channels:${TAG}
    container_name: cc4c
    command:
      - sh 
      - -c 
      - |
        Xvfb :99 -screen 0 1920x1080x16 &
        x11vnc -display :99 -forever &
        sed -i '/width: 1920/c\  width: process.env.WIDTH,' main.js;
        sed -i '/height: 1080/c\  height: process.env.HEIGHT,' main.js;
        sed -i -E '/args: \[/,/\],/c\
                args: [\
                  '\''--enable-unsafe-webgpu'\'',\
                  '\''--enable-accelerated-video-decode'\'',\
                  '\''--enable-accelerated-video-encode'\'',\
                  '\''--disable-notifications'\'',\
                  '\''--no-first-run'\'',\
                  '\''--disable-infobars'\'',\
                  '\''--no-sandbox'\'',\
                  '\''--use-gl=egl'\'',\
                  '\''--in-process-gpu'\'',\
                  '\''--hide-crash-restore-bubble'\'',\
                  '\''--disable-blink-features=AutomationControlled'\'',\
                  '\''--hide-scrollbars'\'',\
                  '\''--enable-features=VaapiVideoEncoder,VaapiVideoDecoder,webgpu,video_encode,gpu_compositing'\'',\
                  '\''--ignore-gpu-blocklist'\'',\
                  '\''--disable-features=UseChromeOSDirectVideoDecoder'\'',\
                ],' main.js;
        sed -i '/videoBitsPerSecond/c\        videoBitsPerSecond: process.env.VIDEO,' main.js;
        sed -i '/audioBitsPerSecond/c\        audioBitsPerSecond: process.env.AUDIO,' main.js;
        exec node main.js
    #devices:
      #- /dev/dri:/dev/dri # Uncomment for Intel Quick Sync (GPU) access
    ports:
      - ${HOST_PORT}:5589 # cc4channels proxy port
      - ${HOST_VNC_PORT}:5900 # VNC port for entering credentials
    environment:
      - WIDTH=${WIDTH}
      - HEIGHT=${HEIGHT}
      - VIDEO=${VIDEO}
      - AUDIO=${AUDIO}
      - TZ=${TZ} # Add your timezone in the Environment variables section with "name" set to TZ and "value" to your local timezone
    volumes:
      - cc4c:/home/chrome # Creates persistent Docker Volume in /var/lib/docker/volumes for Chrome data and main.js
    restart: unless-stopped
volumes:
  cc4c:
    name: ${HOST_VOLUME}

And, here are some sample values to use in the "Environment variables" section of the stack:

TAG=latest
HOST_PORT=5589
HOST_VNC_PORT=5900
WIDTH=1280
HEIGHT=720
VIDEO=8000000
AUDIO=192000
TZ=US/Mountain
HOST_VOLUME=cc4c_config

Let me know how/if this works for you.

EDIT: Double quotes replaced with single quotes in "args:" section.

EDIT2: Made HOST_PORT and HOST_VNC_PORT environment variables.

Thanks! I deleted the original stack, image, and volume, and used this. I get this error trying to deploy. I've restarted Docker twice to no avail. I don't know much about Docker networking to troubleshoot.

Container cc4c Starting Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:5900 -> 0.0.0.0:0: listen tcp 0.0.0.0:5900: bind: address already in use

EDIT: this is a screen grab of the Portainer Networks:

Sounds like the original container is still running. Can you post a screenshot of your Portainer-Containers list? Should look something like this:

I deleted it before deploying the new stack.

In the future, all you need to do is stop the stack, that'll delete the container. Any chance you have VNC already running on your Docker host computer?

Learn something new everyday.
I do have VNC server running, though it hadn't been an issue before. I also have MacOS Screen Sharing for remoting in locally. Killing VNC didn't fix it.

Check the revised docker compose above, I just made HOST_PORT and HOST_VNC_PORT configurable through environment variables. Try using HOST_VNC_PORT=5901 in the environment variables section.

That fixed it. Running sudo lsof -iTCP:5900 told me that port 5900 was being used by screen sharing, so my original container probably was using 5901 and by wiping it out I lost the memory of making that change. Thanks!

I've got it running again. TV is in a huge letterbox though. Thinking it's because the viewport is still 1920x1080, I changed the resolution to 1280x720 and it helped a bit, but it's still not fullscreen on the TV.

changed: Xvfb :99 -screen 0 1920x1080x16 &
to: Xvfb :99 -screen 0 1280x720x16 &

Thoughts?

When you VNC into the container to enter your credentials, did you try setting the embedded Chrome to fullscreen? I use this extension only very occasionally, as I prefer the HDMI encoder based projects, but iirc going "fullscreen" in the container's Chrome was the way.

The change you made to Xvfb seems correct, so I'll change the compose according once you have things running with little or no letterbox.

I ended up reverting it back to 1920x1080. NBC kept erroring out, but as soon as I switched it back it would play again. And the black border all around isn't as large as it initially as large. I'll keep playing around with it. Oh and yes, it is in full screen.

The Chrome version running in the Docker is 114. Not sure how to update it to a more current version, if that would even make a difference.

In the Xvfb command, your viewport WIDTH and HEIGHT environment variables, or both?

1 Like

Sorry i wasn't clear. Here: Xvfb :99 -screen 0 1920x1080x16 &

On top of this, I can't seem to log into Paramount Plus to see if I can get the channels they took off of TVE or Showtime which I've previously had, or into Spectrum. Not sure this will be worth it after all.

Well, well, well. I did all my previous testing with the Channels web client using Chrome browser on my Linux desktop. Today, I gave it another try with the same results. However, I then tried the Channels Android client on my phone, and the streams suddenly appeared.

Any way to implement chrome capture to Plex? Or chrome capture with only work with the channels app?

1 Like