gstreamer gst-rtsp-server是否接受udpsrc(RTP)? [英] Does gstreamer gst-rtsp-server accept udpsrc (RTP)?
问题描述
我想将RTP流输入到gstreamer gst-rtsp-server中.对于初始测试,我使用测试启动.来自github 的c示例(版本1.14).
I want to input an RTP stream into a gstreamer gst-rtsp-server. For initial tests I use the test-launch.c example from github (version 1.14).
当我编译并使用它时,它可以按预期的默认示例很好地工作,并且可以在rtsp://127.0.0.1:8554/test上看到一个流(例如,使用vlc Player):>
When I compile it and use it, it works well with the default example it works as expected and I can see a stream (for example using vlc player) at rtsp://127.0.0.1:8554/test:
./test-launch "( videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 )"
但是如果我使用提供一个RTP udp流
But if I provide an RTP udp stream using
gst-launch-1.0 videotestsrc ! video/x-raw,width=1280,height=720 ! x264enc ! video/x-h264, stream-format=byte-stream ! rtph264pay ! udpsink host=127.0.0.1 port=5000
并且我使用测试启动示例在此端口上使用udpsrc来播放此流,
and I use the test-launch example to play this stream using udpsrc on this port using
./test-launch "( udpsrc port=5000 caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' ! rtph264depay ! rtph264pay name=pay0 )"
没有可用的rtsp流.我是否对 gst_rtsp_media_factory_set_launch
,当采用类似后者的方式放置时?
there is no rtsp stream available. Is there any issue or misconception from my side with gst_rtsp_media_factory_set_launch
, when put it up in a way like the latter?
gst_rtsp_media_factory_set_launch (factory, "( "
"udpsrc port=5000 "
"caps='application/x-rtp, media=(string)video, "
"clock-rate=(int)90000, encoding-name=(string)H264'" ")");
推荐答案
我能够解决此问题.单引号似乎无法成功转义.以下命令组合可与测试启动示例一起使用.
I was able to solve the problem. The single quotes seem not to be escaped successfully . The following combination of command works with the test-launch example.
从连接到/dev/video0的摄像机提供RTP udp流
Provide RTP udp stream from a camera connected to /dev/video0
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videoscale ! "video/x-raw,is-live=true,latency=0" ! x264enc ! "video/x-h264" ! rtph264pay name=pay0 pt=96 ! udpsink host=127.0.0.1 port=5000 sync=false
使用带有(转义)双引号的测试启动示例
Use the test-launch example with (escaped) double quotes
./test-launch "( udpsrc port=5000 caps=\"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264\" ! rtph264depay ! rtph264pay name=pay0 )"
在rtsp://127.0.0.1:8554/test上准备好
流
stream ready at rtsp://127.0.0.1:8554/test
使用gstreamer打开rtsp流(也可以由vlc Player完成)
Open the rtsp stream using gstreamer (which might also be done by vlc player)
gst-launch-1.0 playbin uri=rtsp://127.0.0.1:8554/test uridecodebin0::source::latency=1000
相应地,正确的C代码行将启动这种管道
Accordingly a correct line of c-code to launch this kind of pipeline would be
gst_rtsp_media_factory_set_launch (factory, "( "
"udpsrc port=5600 "
"caps = \"application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264\" ! "
"rtph264depay ! rtph264pay name=pay0 " ")");
这篇关于gstreamer gst-rtsp-server是否接受udpsrc(RTP)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!