BETA: Chrome Capture for Channels

I would recommend hardwiring everything (including the server computer) to see if that's the case. Sometimes that works

That's the thing, switching the chrome capture client to the cat5e coming out of the wall results in constant buffeing, while wifi seems better. It will probably take some troubleshooting, but I have a feeling there's a faulty connection somewhere.

Has anyone had luck running Chrome Capture inside a virtual machine on their NAS? I'm curious if this would work... I could just try but I at least wanted to see if anyone's had any luck with it before.

1 Like

The Chrome Capture take s a lot of resources.
I would probably need good fast hard drives and good processor power to get good use out of Chrome Capture.

I might give it a go and try. My NAS has an i5 and drives at 7200rpm. Seems like that might work. I just don’t know if it would sink the rest of the system LOL. If I get it working, I’ll report back.

1 Like

Thanks for this, these args really seemed to help. I've been iterating with the settings for over a year on an old laptop (i-2330m) running linux mint and with cc4c in portainer. These args along with '--disable-gpu-vsync', and changing the resolution in the main.json and stack to 1280x720 seems to finally give me a mostly non-jittery solution! I still have some periodic buffering when watching a stream but its much better than the default settings.

1 Like

Interesting. Just to confirm, you're talking about a 2nd generation i3 here? What video and audio bitrates are you using? Would you mind posting the docker compose and environment variables you're using?

Yes, using a 2nd gen i3-2330m. Biggest difference seemed to be when I dropped the resolution to 1280 x 720. Then using the arguments below seemed to help. I'm unsure if disabling vsync is helping or not, but I'm currently leaving it enabled without a noticeable drop in performance.

Main.json changes:

const viewport = {
width: 1280,
height: 720,
}

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'
    ],

Stack Changes

version: '3.9'
services:
chrome-capture-for-channels:
image: fancybits/chrome-capture-for-channels:latest
container_name: cc4channels
command:
- sh
- -c
- |
Xvfb :99 -screen 0 1280x720x16 &
x11vnc -display :99 -forever &
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:
- 5589:5589 # cc4channels proxy port
- 5900:5900 # VNC port for entering credentials
environment:
- VIDEO=8000000
- AUDIO=192000
- TZ=US/Eastern
volumes:
- cc4channels:/home/chrome # Creates persistent Docker Volume in /var/lib/docker/volumes for Chrome data and main.js
restart: unless-stopped
volumes:
cc4channels:

Just an FYI with regard to resolution, I noticed my Win11 12th gen i5 was high in gpu usage when using cc4c. I use the executable version and had increased the resolution to 3840x2160 to avoid any sidebars, but when cc4c was showing video, my gpu was between 90-98 percent causing stuttering. Doing some investigating, I found that the Windows Desktop Manager (dwm.exe) in Task Manager was above 50% gpu and Chrome was above 40%. Lowering my resolution to 2880x1620 dramatically lowered dwm.exe usage (down to less than 10%, Chrome stayed the same) and got rid of any stuttering.

1 Like

just use the full screen argument from mine above, dont need to run at 2160p

Did anyone ever figure out why video will sometimes freeze up while audio continues? It appears to be random.

this doesn't work well with all sites. for example nfl network i sometimes get the teams overlay ontop of the full screen video.

When I try this it does work but playback is not smooth, there's some frame loss. Perfectly smooth when setting res above 1080p and not running full screen.

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: