简体   繁体   English

如何在视频HTML5上从gstreamer流接收rtp,rtcp或udp?

[英]How to receive a rtp, rtcp or udp, from a stream of gstreamer, on video HTML5?

I'm trying to get a video stream RTP/RTCP using HTML5, the stream was generated by gstreamer. 我正在尝试使用HTML5获得视频流RTP / RTCP,该流是由gstreamer生成的。 I used examples of gstreamer, so I can pass through RTP ports:5000, and RTCP:5001, and can receive streams using gstreamer. 我使用了gstreamer的示例,因此我可以通过RTP端口:5000和RTCP:5001,并可以使用gstreamer接收流。 But using HTML5 could not receive them. 但是使用HTML5无法接收它们。 So I tried to read a bit about HTML5 and saw that it can receive theora/ogg, webm/vp8, mp4/avc, and protocols may be, HTTP, RTP, RTCP, UDP, and others, but I could not use RTP, RTCP or UDP, HTTP only managed to receive. 因此,我尝试阅读一些有关HTML5的内容,发现它可以接收theora / ogg,webm / vp8,mp4 / avc,并且协议可能是HTTP,RTP,RTCP,UDP等,但是我无法使用RTP, RTCP或UDP,仅设法接收HTTP。 But I had a very satisfactory result using the VLC plugin for Mozilla Firefox, using the UDP protocol. 但是使用UDP协议使用Mozilla Firefox的VLC插件,我得到了非常满意的结果。 I wonder if anyone has any tips, I do not want to use source files as src="/tmp/test.avi" needs to be a video stream that can be udp, RTP, RTCP. 我想知道是否有任何提示,我不想使用源文件,因为src =“ / tmp / test.avi”必须是可以是udp,RTP,RTCP的视频流。 Thank you! 谢谢!

If you don't need to stream at low fps, you can use GStreamer to transcode your stream in MJPEG and stream it in TCP, and then use VLC to get this TCP stream and stream it to HTTP. 如果不需要以低fps进行流传输,则可以使用GStreamer在MJPEG中对流进行代码转换并在TCP中进行流传输,然后使用VLC获取此TCP流并将其流传输到HTTP。 It works very well (0.5 sec of latency), but if you decrease the fps (1 fps) VLC introduces a latency of around 11 sec. 它工作得很好(0.5秒的延迟),但是如果降低fps(1 fps),则VLC会引入大约11秒的延迟。

Here are some test commands that should work out of the box, using the GStreamer videotestsrc : 这是一些应该使用GStreamer videotestsrc开箱即用的测试命令:

  • GStreamer : GStreamer:

    gst-launch -v videotestsrc horizontal-speed=1 ! gst-launch -v videotestsrc horizo​​ntal-speed = 1! deinterlace ! 去隔行! videorate ! 视频率! videoscale ! 视频规模! video/x-raw-yuv, framerate=15/1, width=256, height=144 ! video / x-raw-yuv,framerate = 15/1,width = 256,height = 144! jpegenc quality=20 ! jpegenc质量= 20! multipartmux boundary="--videoboundary" ! multipartmux boundary =“-videoboundary”! tcpserversink host=localhost port=3000 tcpserversink主机=本地主机端口= 3000

  • VLC : VLC:

    vlc -vvv -I rc tcp://localhost:3000 --sout '#standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=localhost:8081}' vlc -vvv -I rc tcp:// localhost:3000 --sout'#standard {access = http {mime = multipart / x-mixed-replace; boundary =-7b3cc56e5f51db803f790dad720ed50a},mux = mpjpeg,dst = localhost:8081 }'

  • then open a browser to http://localhost:8081 (or create an HTML page with an img tag whose "src" attribute is http://localhost:8081 ) 然后打开浏览器访问http://localhost:8081 (或创建一个带有img标签的HTML页面,其“ src”属性为http://localhost:8081

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM