Chrome Capture for Channels

This needs to be installed on the same machine as channels, eh? I have it installed on a linux box and can see its listening on port 5589 but do not see a request coming in. Guessing chrome:// URL handler is expecting localhost only?

1 Like

That is freaking awesome. Now I have to restart tinkering with the weatherscan project.

1 Like

No, it can be installed on any LAN machine and you can use it's IP.

However you do need DVR prerelease which is still uploading.. :sweat:

2 Likes

AHA! I'll sit tight for a bit.

2 Likes

Fantastic work, @tmm1! :clap:

I've been hoping for a solution like this for a long time and now it's happening! :partying_face:

Very excited to give it a try later. :smiley:

4 Likes

Sorry for jumping the gun

It started to work - Chrome launched, tuned to the channel but then abruptly closed.

Now I am seeing the error:

throw new Error("Could not find START_RECORDING function in the browser context");
exports.getStream = getStream;
function assertExtensionLoaded(ext, opt) {
    return __awaiter(this, void 0, void 0, function* () {
        const wait = (ms) => new Promise(res => setTimeout(res, ms));
        for (let currentTick = 0; currentTick < opt.times; currentTick++) {
            // @ts-ignore
            if (yield ext.evaluate(() => typeof START_RECORDING === "function"))
                return;
            yield wait(Math.pow(opt.each, currentTick));
        }
        throw new Error("Could not find START_RECORDING function in the browser context");
    });
}

Any ideas?

PS: while it WAS working the encoder rate was surprisingly very low in terms of CPU usage!

Does this only work with Google Chrome? Or will it work with Chrome based browsers, like Edge, Brave, Chromium etc.

4 Likes

I've seen that but am not sure why it happens. If you rm -rf chromedata then it seems to work reliably again for a while.

1 Like

Would it be fair to say that this is Channels' own (better!) version of PlayOn or are there differences?

4 Likes

You can use, for example:

CHROME_BIN="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser" node main.js

Anything that supports chrome devtools protocol and works with puppeteer should work.

5 Likes

I deleted .config/google-chrome which did reset chrome but unfortunately that error is persisting.

3 Likes

The node command creates a chromedata in the directory where you ran it.

1 Like

For some reason I cannot get a consistent encode going. It starts the stream and minimizes but then moments later restarts. I can stream OK on the box itself and there seems to be plenty of CPU available.

4 Likes

How do you install on Linux Ubuntu? Git only lists windows and Mac

All would be via terminal.

Install Node 18 How to install Node.js 18 on Ubuntu 20.04 LTS by Josh Sherman
Clone repo
Edit main.js and hard code path to chrome
node main.js

4 Likes

Very cool! This is working great for me over here, with CDVR on a Mac. I tried adding some other web pages on my own, like the CDVR Web admin page, just as a test. Edited this into lines 52-62 of main.js:

  app.get('/stream/:name?', async (req, res) => {
    var u = req.query.url
    let name = req.params.name
    if (name) {
      u = {
        cbnc: 'https://www.nbc.com/live?brand=cnbc&callsign=cnbc',
        nbcnews: 'https://www.nbc.com/live?brand=nbc-news&callsign=nbcnews',
        weatherscan: 'https://weatherscan.net/',
        cdvr: 'http://x.x.x.x:8089/admin/settings',
      }[name]
    }

(yes, x.x.x.x is my CDVR's IP address)

...but when I try "tuning in," I get an error: The connection to the tuner was lost. Press play to try again.

Here is my custom channel m3u:

#EXTM3U

#EXTINF:-1 channel-id="weatherscan", Weatherscan
chrome://x.x.x.x:5589/stream/weatherscan

#EXTINF:-1 channel-id="cdvr",CDVR
chrome://x.x.x.x:5589/stream/stream/cdvr

I also am not seeing any activity in Terminal when this attempt fails. Are there other edits required for manually adding our own web page choices as channels, like this?

1 Like

*waits patiently for screenshots of someone's Home Assistant dashboard.

6 Likes

I am up and running on Linux with a RTX 3060. The prior card wasn't cutting it.

One exception I am seeing is if the app is minimized its not capturing video and audio. As soon as I unminimized it works great!

Now I am thinking about Xvfb again to host each encoder instance.

1 Like