<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 10 oct. 2019 06 h 41, jean-philippe <<a href="mailto:jean_philippe_arnaud@yahoo.fr">jean_philippe_arnaud@yahoo.fr</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm trying to use gst-rtsp-server to implement an RTSP server for an IP<br>
camera.<br>
<br>
Here is what I need to do but have not found a way to implement:<br>
- I am looking for a way to have several video streams running at the same<br>
time, streaming video captured from my one v4l2 camera, but with different<br>
encodings.<br>
- I need to be able to add new stream/mounting points without interrupting<br>
the streaming that may already be ongoing.<br>
- I need to be able to capture snapshots (still images) from the camera when<br>
0 or more RTP stream(s) are live, without interrupting the streams that may<br>
already be live.<br>
<br>
The v4l2src cannot be reopened, so creating individual pipelines, one for<br>
each RTSP mounting point is not an option. So the following, based on the<br>
GstRTSPMediaFactory does not work:<br>
for (int i = 0; i < 2; ++i) {<br>
std::string s = "test_" + std::to_string(i);<br>
factory = gst_rtsp_media_factory_new();<br>
gst_rtsp_mount_points_add_factory(mounts, s.c_str(), factory)<br>
gst_rtsp_media_factory_set_launch(factory, "v4l2src ! vpuenc_h264 !<br>
rtph264pay name=pay0 pt96");<br>
gst_rtsp_media_factory_set_shared (factory, TRUE);<br>
}<br>
<br>
With this sort of code, I can stream from test_1 or test_2, but not both.<br>
The reason is that the v4l2src cannot be reopened. <br>
<br>
The following pipeline would work for my requirements, but according to <br>
this link<br>
<<a href="http://gstreamer-devel.966125.n4.nabble.com/RTSP-Server-Can-t-get-multiple-streams-per-URI-to-work-td4672194.html" rel="noreferrer noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/RTSP-Server-Can-t-get-multiple-streams-per-URI-to-work-td4672194.html</a>> <br>
all streams would be sent once a client connects to the aggregate URI as<br>
each stream does not have its own URI and must instead by filtered on the<br>
client side based on the payload type.<br>
This would be too inefficient for my used case and having to filter on the<br>
payload type on the client side does not fit my requirement.<br>
<br>
--> q --> fakesink (used for snapshots via last-sample)<br>
v4l2src --> t --> q --> vpuenc_h264 --> rtph264pay name=pay0 pt=96<br>
--> q --> vpuenc_h264 --> rtph264pay name=pay1 pt=97<br>
<br>
I'm currently contemplating removing the v4l2src from the pipeline used by<br>
the RTSP server and place it into a separate pipeline. I will then need to<br>
somehow forward samples from that v4l2src pipeline to the pipelines used by<br>
the RTSP server.<br>
<br>
So something like the following:<br>
<br>
Pipelines in my app:<br>
v4l2src --> appsink<br>
appsrc --> jpenenc --> filesink (for snapshot)<br>
<br>
RTSP mount / pipelines:<br>
mount_1: appsrc --> vpuenc_h264 --> rtph264pay<br>
mount_2: appsrc --> vpuenc_h264 --> rtph264pay<br>
etc...<br>
<br>
Then in my app, manually push samples into the appsrc elements for each<br>
mounting points. <br>
This approach seems too hacky to be the right way to proceed and I am<br>
concerned it will introduce inefficiencies (will the data be memcpy-ed when<br>
push into the appsrc?).<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Splitting it into its own pipeline is quite common. Though for raw video, it's also a bit challenging. You have to advertise support for VideoMeta to prevent random memcpy (for realignment purpose).</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So am I missing something here? Is there a simpler way to implement this?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">They might not be all super efficient, it depends on the context. But intervideosink/src is extremely simple. There is also some other proxies which I forgot the name, was is pipesrc/sink ? There is also something called proxysrc/sink, they all have a slight difference, I'm under the impression the last one does not do multiplexing, so you'd need to combine with a tee, which is more programming.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks<br>
JP<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/" rel="noreferrer noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank" rel="noreferrer">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div></div></div>