Chrome Capture for Channels

There is definitely a problem with Chrome 115+ and talking to Channels. I just upgraded Chrome to test this out and immediately got the same issues.

Here are a couple of logs from some tests...
2023/07/26 09:27:48.713147 [TNR] Opened connection to M3U-ChromeCaptureforChannels for ch9200 Windy
2023/07/26 09:27:48.717563 [HLS] Starting live stream for channel 9200 from 10.255.1.227
2023/07/26 09:27:50.478347 [HLS] Probed live stream in 1.7607845s: h264 1920x1080 progressive 7388953bps
2023/07/26 09:27:50.488381 [HLS] ffmpeg: chrome-Windy:  [matroska,webm @ 00000000025f2800] Length 6 indicated by an EBML number's first byte 0x06 at pos 1526249 (0x1749e9) exceeds max length 4.
2023/07/26 09:27:50.488381 [HLS] ffmpeg: chrome-Windy:  [matroska,webm @ 00000000025f2800] Seek to desired resync point failed. Seeking to earliest point available instead.
2023/07/26 09:28:12.865313 [HLS] Couldn't generate stream playlist for ch9200-dM3U-ChromeCaptureforChannels-ip10.255.1.227: Timeout waiting for session to start after 12s
2023/07/26 09:28:12.865313 [HLS] Stopping transcoder session ch9200-dM3U-ChromeCaptureforChannels-ip10.255.1.227 (out: 0s, finished: false, first_seq: 0, last_seq: -1)
2023/07/26 09:28:12.865878 [TNR] Closed connection to M3U-ChromeCaptureforChannels for ch9200 Windy
2023/07/26 09:29:17.242425 [HTTP] | 302 |            0s |    10.255.1.227 | GET      "/devices/M3U-ChromeCaptureforChannels/channels/9206/hls?codec=copy&format=copy"
2023/07/26 09:29:17.260215 [TNR] Opened connection to M3U-ChromeCaptureforChannels for ch9206 CNBC
2023/07/26 09:29:17.264569 [HLS] Starting live stream for channel 9206 from 10.255.1.227
2023/07/26 09:29:18.841521 [HLS] Probed live stream in 1.5769511s: h264 1920x1080 progressive 1504602bps
2023/07/26 09:29:26.471787 [HLS] ffmpeg: chrome-CNBC:  [matroska,webm @ 0000000002672800] Unknown element C1 at pos. 0x1aebe0 with length 0x10340efae9b considered as invalid data. Last known good position 0x199ce6, 6 unknown elements in a row
2023/07/26 09:29:26.471787 [HLS] ffmpeg: chrome-CNBC:  [matroska,webm @ 0000000002672800] Seek to desired resync point failed. Seeking to earliest point available instead.
2023/07/26 09:29:29.303446 [HTTP] | 200 |   12.0502392s |    10.255.1.227 | GET      "/devices/M3U-ChromeCaptureforChannels/channels/9206/hls/master.m3u8?codec=copy&format=copy"
2023/07/26 09:29:41.374163 [HLS] Couldn't generate stream playlist for ch9206-dM3U-ChromeCaptureforChannels-ip10.255.1.227: Timeout waiting for session to start after 12s
2023/07/26 09:29:41.374163 [HLS] Stopping transcoder session ch9206-dM3U-ChromeCaptureforChannels-ip10.255.1.227 (out: 8.455011s, finished: false, first_seq: 0, last_seq: -1)
2023/07/26 09:29:41.374163 [ERR] Error during stream M3U-ChromeCaptureforChannels ch9206 CNBC: read |0: file already closed
2023/07/26 09:29:41.374163 [TNR] Closed connection to M3U-ChromeCaptureforChannels for ch9206 CNBC
2023/07/26 09:29:41.375686 [HTTP] | 200 |   24.0582827s |       127.0.0.1 | POST     "/hls/progress?key=ch9206-dM3U-ChromeCaptureforChannels-ip10.255.1.227-remux"
2023/07/26 09:29:41.389492 [SNR] Buffer statistics for ch9206 CNBC: buf=0% drop=0%
2023/07/26 09:29:41.392624 [HTTP] | 500 |   12.0715379s |    10.255.1.227 | GET      "/devices/M3U-ChromeCaptureforChannels/channels/9206/hls/stream.m3u8?codec=copy&format=copy"
2023/07/26 09:29:47.581201 [HLS] ffmpeg: chrome-CNBC:  av_interleaved_write_frame(): Invalid argument
2023/07/26 09:29:47.581201 [HLS] ffmpeg: chrome-CNBC:  Error writing trailer of pipe:: Invalid argument

@tmm1, submitted diagnostics: 1457183c-8333-4b89-a264-42dfb6f0a073

EDIT: And to be clear, the problem is with Channels. VLC plays CC4C perfectly fine:

EDIT 2: Confirmed this again by downgrading Chrome to 114.0.5735.199 and everything worked hunky-dory.

How to Downgrade: https://browsertouse.com/blog/17223/downgrade-install-old-chrome-version/
Version to Downgrade to: Download Google Chrome 114.0.5735.199 for Windows | Uptodown.com

1 Like

Saw a mention over in the HDMI for Channels thread about a popup that came on during a show when using Chrome Capture for Channels, advertising another show. I'm purely speculating here, but is there a way to install extensions in the engine used by Chrome Capture? There's something on the Mac (built for Safari but can be manually installed in Chrome) called Stop the Madness, which, more than a normal popup blocker, deals with all sorts of annoyances when browsing, like this kind of window. There are other windows like this, asking for input, that the extension dismisses. It's almost like the developer addresses every annoyance that bothers him.

This would only work in installs on a Mac, but maybe something similar is elsewhere? List of things it can handle:

I just set this up on MacOS (Mac Mini M1) and with Weatherscan, Channels displays it with miles of pillarboxing LOL... what could I possibly be doing wrong? The Chrome window appears fine, but what Channels on ATV is outputting is just a square inside a ton of black. I've read through this feed and can't seem to figure out why it would be working the way it is.

Yeah, that's a Weatherscan thing, that's just what the source looks like, in any browser, having nothing to do with CC4C or CDVR. I think it's formatted that way because it's intended for small hotel lobby TV's (or something like that.)

Ah that makes sense - I actually had letterboxing on the channel too, but figured out if I just made the Chrome window larger on the host machine, it went to full 4:3 with the pillarboxing.

1 Like

Mentioned previously:

So I've been playing with this more. I moved onto YTTV, and its working better than Fubo. I don't get DRM warnings anymore on ABC affiliates when capturing.

For those dealing with stuttering, see if this argument works well in your main.js:
--disable-gpu-vsync

Disabling vsync helped removed most of the stuttering I was getting on my end. Now I only seem to get it rarely, and its overall less bothersome. Opening new streams causes others to stutter for a brief moment, not sure if there is a way to partition resources better for tabs.

Where are you adding this vsync command in the main.js file? In the encoding section?

1 Like

Here's my code. This code below starts at about line 41 for me. Only thing I added was that --disable-gpu-vsync flag:

        executablePath: getExecutablePath(),
        defaultViewport: null, // no viewport emulation
        userDataDir: path.join(dataDir, 'chromedata'),
        args: [
	  '--disable-gpu-vsync',
          '--disable-notifications',
          '--no-first-run',
          '--disable-infobars',
          '--hide-crash-restore-bubble',
          '--disable-blink-features=AutomationControlled',
          '--hide-scrollbars',
        ],
1 Like

Thanks, I'll give that a try. The video playback is pretty smooth for me already, but during sports you can detect a slight bit of judder every so often.

A couple of small updates for those of you running this project using the Docker container:

First, I posted a docker-compose to support being able to connect to the "session" using VNC to enter credentials and such. It turned out that closing the VNC client also closed the VNC server in the container, so a second connection was not possible without a re-deploy. Easy fix though, the server just needed a "-forever":

version: '3.9'
services:
  chrome-capture-for-channels:
    image: fancybits/chrome-capture-for-channels
    container_name: cc4channels
    command:
      - sh 
      - -c 
      - |
        Xvfb :99 -screen 0 1920x1080x16 &
        x11vnc -display :99 -forever &
        node main.js
    ports:
      - 5589:5589 # cc4channels proxy port
      - 5900:5900 # VNC port for entering credentials
    user: '0:0'
    environment:
      - TZ=US/Mountain
    volumes:
      - /data/cc4channels:/home/chrome/.config
    restart: unless-stopped

Second, if you happen to be running Docker in a Proxmox LXC container like me, make sure you have a minimum of 4 CPU cores assigned as this project requires some horsepower! So far 2GB of memory and 512MB of swap seems OK, but I was redlining with 2 cores.

Thanks

Maybe I'll try the docker method again since the windows version no longer works since the chrome update.

1 Like

Above I showed how you can get the Windows version working by downgrading Chrome:

2 Likes

Thanks, maybe I'll try that. Doesn't seem like a long term solution since this is on my daily driver machine.

I too propose for this tool to use aac audio instead of opus. JF doesn't play nice with opus audio and will try to transcode it.

I tried to change the encoding parameters in the main.js file, to encode aac. But, I don't really have any experience with Chrome encoding, so I'm sure I'm doing something wrong.

We also have the audio PID issue, when trying to edit the current mpg files outside of Channels.

I tried this initially with a Mac Mini i5, and worked but was spotty and was having difficulty keeping pace. Now I'm using this with a Mac Mini M1 and it works very well... but...

The M1 works great with Apple TV, but not iPhone, iPad, or in the Web Player. Seems like there's a remux that goes on for about 22 seconds and then starts all over. The M1 shows the Chrome page closing and starting up again with the remux, and then again around the 22 second mark, closes. It does this endlessly anything other than Apple TV. I can record programs and watch back on those clients - even in progress. Any suggestions from those much smarter than me?

Thanks!

1 Like

Another interesting thing regarding playback of CC4C. It works fine on my Channels DVR app using my android phone and if I port it to Emby and use their Theater app. But it does not play if I try to use the Channels web player nor the Emby web player.

3 Likes

Anyone figure out how to force YTTV quality to max automatically?

EDIT: My regular chrome profile appears to save the quality setting, but chrome capture profile doesn't seem to?

I'm messing around with some main.js settings because I can't get full screen without borders even if I set display greater than 1080p. I'm trying 1280X720x60 in Main.js but I can't get more than 30 FPS doing that. It is a lot smoother with vsync disabled.

Also @tmm1 when I do an 'npm run build' in Windows it builds the Mac OS exe version, not the Windows version and I can see that it's doing so in the build script. I'm not familiar with the commands so I don't know how to fix that so it'll build for Windows.