<div dir="ltr"><div>Hello</div><div><br></div><div>Thanks for the help. I've been stuck on some other issues so haven't had a lot of time to work on this. But I continued today and did a few things:</div><div><br></div><div>- I rewrote Marianna's code for my project as so:</div><div><br></div><div>static GstPadProbeReturn buffer_probe(GstPad * pad, GstPadProbeInfo * info, gpointer pipe)<br>{<br>  using namespace std::literals; <br>  Pipeline* pipeline = (Pipeline*) pipe;<br><br>  now = std::chrono::steady_clock::now();<br><br>  if (GST_PAD_PROBE_INFO_TYPE(info) & GST_PAD_PROBE_TYPE_BUFFER) {<br>    GstBuffer* buffer = gst_pad_probe_info_get_buffer(info);<br>    if (!GST_BUFFER_FLAG_IS_SET(buffer, GST_BUFFER_FLAG_DELTA_UNIT)){<br>      const std::chrono::time_point<std::chrono::system_clock> nowLoc =<br>          std::chrono::system_clock::now();<br>  <br>      const std::time_t t_c = std::chrono::system_clock::to_time_t(nowLoc);<br>      std::cout << "Pad name: " << gst_pad_get_name(pad) << std::endl;<br>      std::cout << "time: "  << std::put_time(std::localtime(&t_c), "%F %T.\n") << std::flush;<br><br>      if (doTheSwitch){<br>        doTheSwitch = false;<br><br>        int camNum = counter % pipeline->config->cameras.size();<br><br>        std::cout << "Switch cam to num: " << camNum << std::endl;<br><br>        for (VideoWriter* writer: pipeline->writers)<br>          writer->textOverlay->setText("Switching cam to: " + std::to_string(camNum));<br>        <br>        //pipeline->setCameraSource(camNum);<br>        lastMeasuredTime = now;<br>        counter++;<br>        nextCam = false;</div><div><br></div><div>        // TODO: Implement this in every camera. <br></div><div>        //  Use cam number to doTheSwitch (make -1 disabled)<br></div><div>        //  Wait for appropriate cam to have keyframe ready</div><div>        //   Then drop probe and re-add element and probe<br></div><div>        return GST_PAD_PROBE_OK;<br>      }<br><br>    }    <br><br>  }<br><br>  return GST_PAD_PROBE_OK;<br>}</div><div><br></div><div>Doing so I found out I only had 1 keyframe per 10 seconds. Problem were the cameras where I set I-frame interval 1 to. Which I thought would be every frame, so 25/seconds. But it seems it can only do 1/sec minimum.<br></div><div>I used ffprobe to verify this. I also had to switch from encoding h264->h265 to even get this working, since the settings seem to be a bit buggy.<br></div><div><br></div><div>If I'm right I should now implement the following:<br></div><div><div>        - Implement this probe in every camera. <br></div><div>        - Use cam number to doTheSwitch (make -1 disabled)<br></div><div>        - Wait for appropriate cam to have keyframe ready</div><div>        - Then drop probe and re-add element and probe</div><div><br></div><div>Will keep y'all posted.</div><div><br></div><div>Kind regards,</div><div>Bilel Bghiel.<br></div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 9, 2022 at 3:50 PM Marc Leeman <<a href="mailto:marc.leeman@gmail.com">marc.leeman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Oh forgot,</div><div><br></div><div>you can inspect the buffers and see if there is <i><em><code>GST_BUFFER_FLAG_DELTA_UNIT  </code></em></i><code>to get an idea if it is I-Frame/SPS/PPS: these have not.<br></code><em><code></code></em><i><em><code></code></em></i></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 7 Jun 2022 at 09:40, Marc Leeman <<a href="mailto:marc.leeman@gmail.com" target="_blank">marc.leeman@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>I am doing something similar for ages (switching in the compressed domain), based on an I-Frame (and SPS/PPS).</div><div><br></div><div>When using different cameras, you need to make certain that you have the new SPS/PPS before switching based on an I-Frame. If you have 'the same' cameras, make certain that  your configuration is the same so they generate the same (or compatible) SPS/PPS (though that is not a fault tolerant implementation).<br></div><div><br></div><div>After switching, you need to call <br></div><div><br></div><div>gst_bin_recalculate_latency(GST_BIN(self));</div><div><br></div><div>It should result a feed that is free of hiccups</div><div><br></div><div>.From what I can tell, your SPS/PPS corrupts your video until you get the new one in the video feed.<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 3 Jun 2022 at 18:45, Bilel Bghiel via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hello</div><div><br></div><div>I'm currently using the following setup:</div><div><br></div><div>9 IP camera's:<br></div><div>RTSPsrc - rtph264depay - h264parse - tee <br></div><div><br></div><div>VideoWriter</div><div></div><div>Input-selector - tee - avdec264 - <video editing stuff > - videorate - avenc_flv - flvmux - RTMPsink OR filesink</div><div><br></div><div>I have 9 camera's which are all connected to the videowriter input-selector. This works fine. Now when switching the camera's the screen seems to freeze, only changing the pixels where they are different.</div><div><br></div><div>Demo:  <a href="https://www.youtube.com/watch?v=GJU1eRMgKt0" target="_blank">https://www.youtube.com/watch?v=GJU1eRMgKt0</a></div><div>(e.g: 0:26, 0:35)</div><div><br></div><div>I've been playing around with I-frame settings on the camera's. Which I now set to 1. But still I get the results as seen in the video. Has anybody ever seen this before? And know how to fix this?</div><div><br></div><div>Thanks in advance<br></div></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">g. Marc</div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">g. Marc</div>
</blockquote></div>