Chrome Capture for Channels

Thanks for asking. That has not changed. I'm pulling from the fancybits repo and running on my M1 Mac mini.

Sometimes i have stream running for hours with no issues.
Yesterday it did it 3 minutes in, to the recording. recorded the play button for 31 minutes.

I watch the stream on my firestick, what i have ended up doing is when i notice it happens i run to my computer and connect to container using vnc and start the player manually and it starts playing again.

snippet is from the recording at the 3min mark:
snippet

1 Like

Sounds like the stream is getting interrupted. What are the specs on your Docker host computer? What OS are you running on the host? What's you Internet connection like? Is there a VPN involved?

EDIT: I just had it happen to me after around 4 hours. This is the first time I'm using NBC via cc4c, are you seeing this with other sites too?

That's the channel i mostly use with cc4c, but i have not had this issue on other sites.

From what i see in the recording the whole page does not refresh just the video frame, so it will not run the functions on: cc4c github - nbc code because the whole page did not refresh.

Is it possible to add a timer that would check every x amount of seconds if video is paused.

Example:

setInterval(() => {
  let video = document.querySelector('video');
  const isPaused = video.paused;
  if (isPaused) {
   // Run Code to Play Video and Full Screen 
  }
}, 10000); // Executes every 10 second, or set in env var


Users can allow if they want this type of timer to run via env var, Ex.

allowPausedTimer=False; // Default is False, If true it setInterval will run on `pauseInterval`
pauseInterval=10000; // Default 10 Seconds

You should give it a try and see how it works.

Although I've contributed some to this project, I'm mostly just a user like you. My particular interest is in the Docker version, as I virtualize and containerize everything.

This issue is looking like it's not specific to the Docker version, so I'm going to bow out.

Forked the repo and have been testing it.

Works so far for me it checks if it is paused and re-runs the code to play and full-screen the video.

Made some other changes to fix some code that was not working correctly or deprecated.

Used JSDoc to add types to some functions to allow type-hints.

Here is my repo:

1 Like

cc4c Transcoding Fails on UGREEN NAS:
[LIBVA]:CRITICAL - DdiMedia_SyncBuffer:4286: Invalid buffer
Hi all,
I'm running into a persistent hardware transcoding error when using cc4c in a Docker container on my UGREEN NAS.
The strange part is that the transcode seems to work perfectly, but the process crashes with a critical error at the very end, right as it's finishing. This isn't a "permission denied" error at the start, but a crash during what looks like memory cleanup.


My Setup
• NAS: UGREEN 480T Plus
• NAS OS: UGOS Pro (Latest Firmware: 1.9.0.0075)
• Container: cc4c running in Docker, managed via Portainer
• GPU Passthrough: "Graphics Card Performance" is enabled in the UGOS Docker app.


The Error Log

The log shows the Intel iHD driver initializes correctly, the stream maps, and the h264_vaapi encoder successfully encodes all 60 frames. But then, it terminates with this error:

[AVHWDeviceContext @ 0x48053d40] VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 24.4.2 (b813073).
[h264_vaapi @ 0x4869bc00] Using VAAPI profile VAProfileH264High (7).
Stream #0:0: Video: h264 (High), 1 reference frame, vaapi... 1280x720 ... 4000 kb/s, 60 fps
frame= 60 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.96 bitrate=N/A speed= 3.3x
Output file #0 (/dev/null):
Output stream #0:0 (video): 60 frames encoded; 60 packets muxed (37764 bytes);
Total: 60 packets (37764 bytes) muxed
Terminating demuxer thread 0
[LIBVA]:CRITICAL - DdiMedia_SyncBuffer:4286: Invalid buffer


What I've Tried So Far
Based on my investigation, this seems to be a driver/library incompatibility, not a user permission error.

  1. Updated NAS Firmware: I am running the latest UGOS Pro 1.9.0.0075, which was supposed to include a "new transcoding framework" to fix bugs. The problem persists.
  2. Re-pulled Container Image: In Portainer, I forced a "Re-pull image" on my cc4c stack and updated it to ensure I have the latest container with the newest FFmpeg/libva libraries.
  3. Toggled GPU Passthrough: I have turned the "Graphics Card Performance" setting off and on again in the UGOS Docker settings.
  4. Rebooted: I have rebooted the NAS multiple times.
    My hypothesis is that the FFmpeg/libva libraries inside the cc4c container are still incompatible with the new Intel iHD driver (v24.4.2) that UGREEN is using in its latest firmware.
    Is this a known issue? Is there a beta or dev tag for the cc4c container I should be using that has newer, more compatible libraries?
    Thanks for any help you can provide!

What does the Docker Compose you're using look like?

Im using project one click to install fresh... no existing anything: empty docker until I start with the one click install. olivetin-ezstart... So portainer, olivertin, and channels all install fine.All run and behave normally until HW transcode is used. SW transcode works fine.

version: '3.9'
services:
  cc4c:
    # 2025.04.20
    # GitHub home for this project: https://github.com/bnhf/chrome-capture-for-channels.
    # Docker container home for this project with setup instructions: https://hub.docker.com/r/bnhf/cc4c.
    image: bnhf/cc4c:${TAG:-latest}
    container_name: cc4c
    shm_size: '1gb'
    devices:
      - /dev/dri:/dev/dri # Uncomment for Intel Quick Sync (GPU) access
    ports:
      - ${HOST_PORT:-5589}:${CC4C_PORT:-5589} # cc4c proxy port
      - ${HOST_VNC_PORT:-5900}:5900 # VNC port for entering credentials
    environment:
      - VIDEO_BITRATE=${VIDEO_BITRATE:-6000000} # Video bitrate in bits per second  [number] [default: 6000000]
      - AUDIO_BITRATE=${AUDIO_BITRATE:-256000} # Audio bitrate in bits per second  [number] [default: 256000]
      - FRAMERATE=${FRAMERATE:-30} # Minimum frame rate  [number] [default: 30]
      - CC4C_PORT=${CC4C_PORT:-5589} # Port number for the server  [number] [default: 5589]
      - VIDEO_WIDTH=${VIDEO_WIDTH:-1920} # Video width in pixels (e.g., 1920 for 1080p)  [number] [default: 1920]
      - VIDEO_HEIGHT=${VIDEO_HEIGHT:-1080} # Video height in pixels (e.g., 1080 for 1080p)  [number] [default: 1080]
      - VIDEO_CODEC=${VIDEO_CODEC:-h264_nvenc} # Video codec (e.g., h264_nvenc, h264_qsv, h264_amf, h264_vaapi)  [string] [default: "h264_nvenc"]
      - AUDIO_CODEC=${AUDIO_CODEC:-aac} # Audio codec (e.g., aac, opus)  [string] [default: "aac"]
      - TZ=${TZ} # Your local timezone in Linux "tz" format.
    volumes:
      - cookies:/home/chrome/chromedata/Default/Cookies # Creates a persistent Docker Volume in /var/lib/docker/volumes for Chrome cookie data.
      - logins:/home/chrome/chromedata/Default/Login Data # Creates a persistent Docker Volume in /var/lib/docker/volumes for Chrome user login data.
      - localstorage:/home/chrome/chromedata/Default/Local Storage # Creates a persistent Docker Volume in /var/lib/docker/volumes for Chrome user local data.
      - prefs:/home/chrome/chromedata/Default/Preferences # Creates a persistent Docker Volume in /var/lib/docker/volumes for Chrome user preferences data.
      - secure:/home/chrome/chromedata/Default/Secure Preferences # Creates a persistent Docker Volume in /var/lib/docker/volumes for Chrome user secure data.
    restart: unless-stopped
    
volumes:
  cookies:
  logins:
  localstorage:
  prefs:
  secure:

If you want to update the container to test (this is not permanent -- it'll be good until the next time you stop and restart the stack), you can exec into the container (using the Portainer "Quick Action" button for this purpose), and execute:

apt update
apt upgrade

Inspect the list of packages upgraded to see if you think anything might be relevant. This will update everything in the container to current for the Debian 12 (bookworm) image it's based on.

However, having said all that, be aware there are limitations in the Linux version of Chrome and Puppeteer that result in very few websites even using hardware acceleration in cc4c. Weatherscan is about the only one I've ever seen take advantage of it.

I would would suggest disabling hardware acceleration, and go with software.

1 Like

Since ESPN+ went DRM, I’ve been working on a way to integrate ESPN+ into Chrome Capture channels. I went a little overboard and devised a way to make “virtual channels” with their lineup. The program grabs the live/upcoming events from their API makes up a schedule and makes XML and M3U and puts into Channels.

It’s still pretty raw but been fun to work on.

3 Likes

Any chance you'll share? I may be able to Macgyver that for ah4c or adbtuner

1 Like

I'd be down to test. I haven't used cc4c in a while though with all the issues with chrome updates and such. Does this work in windows still? Or just docker?

Sure - it's quite hobbled together right now, but thats my intention to get it out for anyone to test it. And I'm in way over my head so hopefully someone smarter would get interested in it too :smile:

1 Like

It’s all python based with a small SQLite DB that stores the API scrape. So I think it should work with windows but honestly not sure.

I think a container is probably the route I’ll take.

The one major thing I have to figure out is full screen. I made some changes to CC4C main.js to get CC4C to send a “F” key to trick ESPN player to go full screen but it’s not consistent just yet. I’ll get there …

I meant cc4c lol. I used to run the main.js directly on windows. But I'm not sure that still works does it?

Very cool. I was thinking something similar but having it call my HDMI for Channels setup with the event id to direct tune.
Will be watching as it evolves and hope you will share. The upcoming multi-view will be much better if I can get espn+ back.

I'm trying to install cc4c in linux (Debian 12.12) directly.
I installed node, npm, and puppeteer. I cloned the project and updated main.js with the path to Chrome that Puppeteer installed. It launches, but I get the error: "failed to start stream Watch the MSNBC Live Stream - NBC.com Extension has not been invoked for the current page (see activeTab permission). Chrome pages cannot be captured."

The Puppeteer version was 24.5.0 which may not have the above-mentioned fix, so I updated puppeteer with "npm install puppeteer@latest" which installed 24.26.0.

Still getting the same error... Does that version have the update, or do I need to patch the code?

Thanks,
-Jay

The instructions would be basically the same as described here for installing in a Debian LXC in Proxmox:

Whoa! That actually worked! OK, so I went into the folder in which I cloned the repo, added the environment variables, and installed bun. I didn't reinstall Chrome and I used the same main.js that I modified to run the Chrome that Puppeteer installed. The command to run xvbf and vnc complained because those were not installed, but cc4c launched in the foreground. I'm using the vnc server that comes with KDE, so I suppose those aren't needed. Performance is great. It's using about 20 - 25% total CPU with one stream. This is on a I7-7700 which is also running the Channels DVR server, so I'll have to see how it does while recording as well, but this seems workable. Thanks!