简体   繁体   English

将网页呈现为H.264

[英]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. 我正在尝试将HTML呈现为H.264流,然后将其流式传输到网络上的另一台PC。

I've got the last part, streaming to to another PC on my network down. 我已经有了最后一部分, streaming to to another PC on my network 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. 我需要加载网页,获取图像,运行javascript和打开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 我可以想象这个工作的唯一方法是,如果我运行浏览器(或者可能是CEF之类的东西?),并“捕获”输出,并将其渲染为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. 我基本上试图像OBS的BrowserSource那样做,但我不使用OBS的唯一原因是因为我无法找到一个无头运行它的好方法。

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 Tab Capture API和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. Chromium可以方便地处理所有渲染,包括引入WebGL渲染的东西,并在一个漂亮的整洁MediaStream中为您整合。 From there, you can use it in a WebRTC call or pass off to a MediaRecorder instance. 从那里,您可以在WebRTC调用中使用它或传递给MediaRecorder实例。

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 https://developer.chrome.com/extensions/tabCapture

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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