与gst-rtsp-server分开的RTSP有效负载 [英] Separate RTSP payloads from gst-rtsp-server
问题描述
我有一个RTSP视频源(h265),可以使用VLC进行显示.我想将流分成两个,一个以原始分辨率(用h265编码),另一个以新的较低分辨率(用h264编码).这两个新流也都应该是RTSP流,可以在VLC中查看.
I have an RTSP video source (h265) which I can display using VLC. I would like to split the stream into two, one at native resolution (encoded with h265) and the other at a new, lower resolution (encoded with h264). Both of the new streams should also be RTSP streams, viewable with VLC.
出于带宽考虑,我只能将单个客户端连接到主要源.
Due to bandwidth considerations, I can only connect a single client to the primary source.
到目前为止,我有一个工作正常的gst-rstp-server设置,并且有一个媒体工厂运行此gst启动字符串:
So far, I have a working gst-rstp-server setup, with a single media factory running this gst launch string:
rtspsrc location = ... !rtph265depay!h265parse!T恤名称= t!队列 !rtph265pay 名称= pay1 pt = 96吨.!队列!解码器!视频规模!视频率!video/x-raw,framerate = 30/1,width = 640,height = 480!x264enc比特率= 500speed-preset =超快调谐= zerolatency!h264parse!rtph264pay name = pay0 pt = 96
rtspsrc location=... ! rtph265depay ! h265parse ! tee name=t ! queue ! rtph265pay name=pay1 pt=96 t. ! queue ! decodebin ! videoscale ! videorate ! video/x-raw,framerate=30/1,width=640,height=480 ! x264enc bitrate=500 speed-preset=superfast tune=zerolatency ! h264parse ! rtph264pay name=pay0 pt=96
我为媒体工厂设置了一个安装点,并且可以连接到VLC,例如."rtsp://127.0.0.1:8550/test".有了这个,我只能得到VLC中哪个是pay0的子流.我可以看到两个子流都在通过更改哪一个是pay0来工作.但是VLC如何显示我的薪水1?
I set up a mount point for the media factory and can connect to VLC, eg. "rtsp://127.0.0.1:8550/test". With this, I can only get whichever substream is pay0 in VLC. I can see that both substreams are working by changing which one is pay0. But how can I have VLC show my pay1?
否则,我如何准备Tee的原始视频源,然后让两个不同的媒体工厂(具有不同的gst启动字符串...)将Tee的视频源用作自己的源?
Otherwise, how can I tee the original video source, then have two different media factories (with different gst launch strings...) use the tee's as their own source?
推荐答案
两个流都同时发送给您.通常情况下,pay0&pay1,将发送视频&声音的.对于需要2个独立视频流的情况,您将需要修改代码.
Both streams are being sent to you at the same time. Usually the case for pay0 & pay1, would be sending video & audio. For your case where you want 2 separate video streams you will need to modify code.
要实现的目标的简单示例可以通过修改 gst-rtsp-server/examples/test-launch.c
A simple example of what you want to achieve can be done by modifying the file at gst-rtsp-server/examples/test-launch.c
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory, argv[1]);
gst_rtsp_media_factory_set_shared (factory, TRUE);
gst_rtsp_mount_points_add_factory (mounts, "/stream1", factory);
gst_rtsp_media_factory_set_launch (factory, argv[2]);
gst_rtsp_media_factory_set_shared (factory, TRUE);
gst_rtsp_mount_points_add_factory (mounts, "/stream2", factory);
然后从开始./test-launch"rtspsrc location = ...!videorate!video/x-raw,framerate = 30/1,width = 640,height = 480!x264enc bitrate = 500 speed-preset = superfast tune = zerolatency!h264parse!rtph264pay name = pay0 pt = 96"
然后,您的相机上将有2个消费者.如果您只想消费一次,则取决于您的流&流量.将其用作 gst_rtsp_media_factory_set_launch
管道的src.
You would then have 2 consumers on your camera though.
If you prefer to only consume once, it would be up to you to T the stream & make it available as the src for your gst_rtsp_media_factory_set_launch
pipeline.
这篇关于与gst-rtsp-server分开的RTSP有效负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!