摘要
在浏览器中,所有的数据交换都必须遵守HTTP协议,数据必须在完全传输完毕后才能由JavaScript进行处理。在这种情况下,是无法来实现实时的流数据传输。对于传统的云直播服务则需要提供视频云转码的功能,以便于兼容各种设备。随着WebSocket技术的开发应用,借助该技术,可以在浏览器上实现流传输,使得视频实时直播成为了可能。该系统实践了这个过程,使用JavaScript在浏览器上对视频流进行De-multiplexing、Decoding、Encoding、Multiplexing,并根据浏览器对视频格式的支持情况,针对直播云服务器提供的视频转发功能,基于最新的接口,将视频的解码、编码、渲染等操作集成到客户端,通过自动选择视频流的处理方式,最后实现实时直播。视频直播服务器不再需要处理视频流,客户端通过WebSocket接收视频数据并根据浏览器所支持的编码格式进行重编码。该系统的实践具有直播带宽要求低、服务端低配置、低延迟、无法盗链等优点。
In the browser,all data exchange must comply with the HTTP,and the data must be processed by JavaScript after it is completely transmitted.In this case,it is impossible to achieve real-time streaming data transmission.For traditional cloud live broadcast services,the video cloud transcoding function needs to be provided in order to be compatible with various devices.With the development and application of WebSocket technology,with this technology,streaming can be realized on the browser,making it possible for live video to be broadcast live.This system has practiced this process,using JavaScript to perform De-multiplexing,Decoding,Encoding,and Multiplexing on the browser,and according to the browser’s support for the video format,based on the video forwarding function provided by the live cloud server,the video decoding,encoding,rendering and other operations are integrated into the client based on the latest interface.By automatically selecting the processing method of the video stream,the real-time live broadcast is finally achieved.The video live server no longer needs to process the video stream.The client accepts the video data through WebSocket and re-encodes it according to the encoding format supported by the browser.The practice of this system has the advantages of low live broadcast bandwidth requirements,low server configuration,low latency,and inability to steal the chain.
作者
王金环
李宝敏
WANG Jin-huan;LI Bao-min(Department of Intelligent Science and Information Engineering,Xi’an Peihua University,Xi’an 710125,China;School of Computing,Xi’an Technological University,Xi’an 710021,China)
出处
《计算机技术与发展》
2020年第12期210-215,共6页
Computer Technology and Development
基金
陕西省2018年度陕西省教育专项科研计划项目(18JK1085)。