简体   繁体   中英

Rendering webpage as H.264

I'm trying to render HTML as a H.264 stream, and then streaming it to another PC on my network.

I've got the last part, streaming to to another PC on my network down. Now my only problem is rendering the webpage.

I can't render it once, because it isn't a static webpage. I need to load the webpage, fetch images, run javascript and open websockets.

The only way I can imagine this working, is if I run a browser (or maybe something like CEF ?), and "capture" the output, and render it as H.264

I'm basically trying to do the same as OBS' BrowserSource, but the only reason I'm NOT using OBS, is because I can't find a good way to run it headless.

NOTE: I need to be able to do it through the commandline, completely headless.

I've done this with the Chromium Tab Capture API, and the Off-Screen Tab Capture API.

Chromium will conveniently handle all the rendering, including bringing in WebGL rendered stuff, and composite all together in a nice neat MediaStream for you. From there, you can use it in a WebRTC call or pass off to a MediaRecorder instance.

The off-screen tab capture even has a nice separate isolated process that cannot access local cameras and such.

https://developer.chrome.com/extensions/tabCapture

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM