Git Product home page Git Product logo

rtsp-ws-proxy's Introduction

RTSP-WS-Proxy

一个RTSP转Websocket的服务端和对应的web端播放器

服务端:

WSServer目录下 环境基于centos7,如需在其它环境下使用,请先替换使用到的第三方库 服务端编译:

	cd WSServer
	make

服务端依赖的第三方库: boost 版本不宜过高,否则会与websocketpp不兼容,我使用的是yum安装的,版本号1.53 websocketpp include中已有头文件,不需要单独编译,依赖boost jsoncpp 我使用的版本是1.8.4 ffmpeg 使用的是4.2.2,早一些的版本也可使用 如更换使用环境,请检查编译后的第三方库,更新Makefile服务端运行方法: 服务端运行方法:

	WSProxy 9001

9001是服务端绑定的websocket端口

web端:

ClientPlayer目录下 wsplayer.js是播放器,testplayer.html是示例,需要浏览器支持html5的mse 播放器使用方法示例:

var video1 = document.getElementById('video1');
    player = new wsplayer("ws://192.168.5.133:9001","rtsp://192.168.5.1/stream1",video1);    
    player.openws();

在new wsplayer("ws://192.168.5.133:9001","rtsp://192.168.5.1/stream1",video1);中使用的三个参数,第一个是服务端的ws地址,第二个是要打开的rtsp地址,第三个是播放器绑定的htmldocument对象

原理:

web端将要打开的rtsp地址发送给服务端,服务端打开rtsp流成功后将流的mime发送给web并开始推送fmp4数据,web利用mime初始化mse,成功后将websocket收到的二进制数据交给mse播放,程序目前只支持h264视频和aac音频,如要接入其它格式,请修改服务端,在服务端进行转码工作

rtsp-ws-proxy's People

Contributors

garefield avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.