Skip to content

Latest commit

 

History

History
66 lines (46 loc) · 2.17 KB

README.md

File metadata and controls

66 lines (46 loc) · 2.17 KB

RTSP Client/Server base on Boost.Asio

基于boost.asio开发一个rtsp库

rtsp协议的优势:

协议名称 网络传输协议 延时 编码类型 HTML5支持情况
RTSP TCP/UDP/组播 0~3s H264/H265 不支持,(RTSP over HTTP除外)
RTMP TCP 0~3s H264/H265(CodecID =12) 不支持
HLS HTTP短连接 1~10s H264/H265 video标签支持
HTTP-FLV HTTP长连接 0~3s H264/H265(CodecID =12) flv → fmp4 → video标签
webrtc HTTP长连接 0~3s H264/H265 video标签原生支持
srt WebSocket 0~3s H264/H265(CodecID =12) flv → fmp4 → video标签

使用协程 选择boost.asio的原因:方便开发者集成librtsp库时,可以与其他通信库共用一个io_context

支持H.264/H.265 支持rtsp client/server

支持UDP/TCP/组播三种方式推拉流

rtsp server 有人拉流时,触发通知 提供inputFrame接口,输入标准的H.264/H.265数据

rtsp client 解析出标准的H.264/H.265 视频帧

example ffmpeg rtsp推流验证rtsp server 结合sdl 做一个rtsp player

GOP 可配置 缓存一个GOP,实现秒开 或者不缓存

使用boost::beast::http::request解析rtsp报文 RFC 2326: Real Time Streaming Protocol (RTSP) 1.4 Protocol Properties Easy to parse: RTSP can be parsed by standard HTTP or MIME parsers. 规避HTTP的校验

参考资料: RFC 2326: Real Time Streaming Protocol (RTSP) https://www.rfc-editor.org/rfc/rfc2326.html

RFC 2550: RTP: A Transport Protocol for Real-Time Applications https://www.rfc-editor.org/rfc/rfc3550.html

RFC 3984: RTP Payload Format for H.264 Video https://www.rfc-editor.org/rfc/rfc3984.html

RFC 2435: RTP Payload Format for JPEG-compressed Video https://www.rfc-editor.org/rfc/rfc2435.html

参考项目: https://github.com/bluenviron/gortsplib

https://github.com/mnpk/librtsp

https://github.com/mpromonet/v4l2rtspserver