V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Seulgi
V2EX  ›  程序员

实时通讯,摄像头作为设备端推流, app 作为用户端拉流,推拉流协议对比

  •  
  •   Seulgi · 271 天前 · 1327 次点击
    这是一个创建于 271 天前的主题,其中的信息可能已经有所发展或是发生改变。

    rtmp 最通用,延迟也低,但是 SRS 之类的稳定版本还不支持 h265 。
    fls ,http 相关的,延迟高,但是可分发,cdn 好做。
    webrtc ,延迟最低,还可以做通话,会议视频等。
    想咨询下现在市面自己搞流媒体服务,架构,部署,协议选型都是怎么做的。

    5 条回复    2024-02-26 16:11:30 +08:00
    Seulgi
        1
    Seulgi  
    OP
       271 天前
    比如拿 SRS 开源搭一套,就简单支持 rtmp ,或者 webrtc ,也都可以支持,再加一些边缘服务器部署了当转码之类的,畅所欲言。
    NessajCN
        2
    NessajCN  
       271 天前
    Live streams can be published to the server with:

    |protocol|variants|video codecs|audio codecs|
    |--------|--------|------------|------------|
    |[SRT clients](#srt-clients)||H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3|
    |[SRT cameras and servers](#srt-cameras-and-servers)||H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3|
    |[WebRTC clients](#webrtc-clients)|Browser-based, WHIP|AV1, VP9, VP8, H264|Opus, G722, G711 (PCMA, PCMU)|
    |[WebRTC servers](#webrtc-servers)|WHEP|AV1, VP9, VP8, H264|Opus, G722, G711 (PCMA, PCMU)|
    |[RTSP clients](#rtsp-clients)|UDP, TCP, RTSPS|AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG and any RTP-compatible codec|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM and any RTP-compatible codec|
    |[RTSP cameras and servers](#rtsp-cameras-and-servers)|UDP, UDP-Multicast, TCP, RTSPS|AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG and any RTP-compatible codec|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM and any RTP-compatible codec|
    |[RTMP clients](#rtmp-clients)|RTMP, RTMPS, Enhanced RTMP|AV1, VP9, H265, H264|MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), G711 (PCMA, PCMU), LPCM|
    |[RTMP cameras and servers](#rtmp-cameras-and-servers)|RTMP, RTMPS, Enhanced RTMP|H264|MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3)|
    |[HLS cameras and servers](#hls-cameras-and-servers)|Low-Latency HLS, MP4-based HLS, legacy HLS|AV1, VP9, H265, H264|Opus, MPEG-4 Audio (AAC)|
    |[UDP/MPEG-TS](#udpmpeg-ts)|Unicast, broadcast, multicast|H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3|
    |[Raspberry Pi Cameras](#raspberry-pi-cameras)||H264||

    And can be read from the server with:

    |protocol|variants|video codecs|audio codecs|
    |--------|--------|------------|------------|
    |[SRT](#srt)||H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3|
    |[WebRTC](#webrtc)|Browser-based, WHEP|AV1, VP9, VP8, H264|Opus, G722, G711 (PCMA, PCMU)|
    |[RTSP](#rtsp)|UDP, UDP-Multicast, TCP, RTSPS|AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG and any RTP-compatible codec|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM and any RTP-compatible codec|
    |[RTMP](#rtmp)|RTMP, RTMPS, Enhanced RTMP|H264|MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3)|
    |[HLS](#hls)|Low-Latency HLS, MP4-based HLS, legacy HLS|AV1, VP9, H265, H264|Opus, MPEG-4 Audio (AAC)|

    And can be recorded and played back with:

    |format|video codecs|audio codecs|
    |------|------------|------------|
    |[fMP4](#record-streams-to-disk)|AV1, VP9, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G711 (PCMA, PCMU), LPCM|
    |[MPEG-TS](#record-streams-to-disk)|H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video|Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3|

    ref: https://github.com/bluenviron/mediamtx/blob/main/README.md

    个人选择:rtsp/webrtc 推流。hls 看
    Seulgi
        3
    Seulgi  
    OP
       271 天前
    @NessajCN #2 我看看。之前只看了 zlm 和 srs
    mightybruce
        4
    mightybruce  
       271 天前
    webrtc 是为了双向通信,视频和音频双向 webrtc 适合的视频会议,远程桌面分享,而这个在直播里面没有必要,并且做并发更困难。

    直播里面主要是一对多广播音视频信息,并没有多少需要双向的需求。

    搞清楚服务的定位先, 如果是监控摄像头,那么首选是 rtsp, 个人电脑摄像头或手机推流的确是 rtmp 。
    Seulgi
        5
    Seulgi  
    OP
       271 天前
    @mightybruce #4 嗯,确实 webrtc 相关的 cpu 占用会比其他协议更大。但是国内目前摄像头推流阿里、小米都还是 rtmp ,rtsp 还是少。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2945 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 08:12 · PVG 16:12 · LAX 00:12 · JFK 03:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.