在 Web 浏览器上流式传输或伪流式 h.264

Stream or pseudo-stream h.264 on web browser

我实际上是使用 raspivid 从树莓派流式传输原始 h.264。

然后,我在端口 8080 上使用 netcat:

通过 TCP/IP 发送流
raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | nc -lkv4 8080

实际上,这个流目前正在运行并且我想在我的 webApp 上阅读它

我已经尝试使用 HTML5 video 标签这样做:

<video src="rtp://192.168.42.3:8080">
    Your browser does not support RTP streams.
</video>

<video src="rtsp://192.168.42.3:8080">
    Your browser does not support RTP streams.
</video>

但其中 none 有效。我什至无法在我的 VLC 播放器上读取流 rtp://192.168.42.3:8080。我在这里遗漏了什么吗?


编辑:

我实际上已经尝试了 cvlcGStreamer,但我仍然无法通过网络浏览器或通过 VLC 连接到 RTP...我很想知道什么接下来检查。

raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' :demux=h264


raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | \
gst-launch-1.0 udpsrc port=8080 \
                   caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" \
                   ! rtph264depay \
                   ! avdec_h264 \
                   ! autovideosink

您可以使用特定的编解码器将视频流作为 HLS、MPEG DASH、WebRTC 传送到网络浏览器(H264 基线视频和 AAC 音频用于 HLS/MPEG,Opus 用于 WebRTC)。