How to stream multiple videos?

I am working on an interface based on PyQt5 to control my ROV and am going to use 3 cameras on the vehicle. I am using GStreamer to stream the video outputs from the vehicle to the topside computer via ethernet and was successful with this step. To receive the video data I was planning to use the Video class provided here and I was going to show the streams simultaneously. The problem is that when I try to create a second instance Python is not able to create the appsink to receive the frame. To solve this problem I tried adding a button that would recreate the instance with a different port so that I could at least see the output but this failed too because even though I deleted the object yet again appsink could not be created. Out of curiosity while I was running my interface with a single Video object I ran another code which utilizes the Video class and the second I started that code the interface stopped playing the video. Is there a way to get around this problem? How can I display multiple streams using Blue’s Video class.
This is the error message given when I try to create another Video object.

Hi @Efe,

I’m unfortunately not able to test this at the moment. A few questions:

  1. Are you certain that all your video streams are actually available?
  2. Have you checked that they can be connected to with a direct gstreamer pipeline (instead of via Python)?
  3. Have you made sure that your Python code isn’t trying to bind two connections to the same UDP port?

The error message you’ve posted is telling you that the video_sink object is None rather than a meaningful gstreamer object, so presumably it failed to be created correctly, which (looking at the code) seems to be created by binding to the name appsink0. I see two options for that to fail:

  1. that element may not exist (because it failed to be created due to the stream not being accessible)
  2. gstreamer may handle names globally, in which case appsink0 may be taken by the first video stream, in which case the second one may need to bind to appsink1 or similar
    • I’m curious whether that works - it may be a reasonably simple solution to the problem

Hi @EliotBR,
Thanks for your reply. I am sure that all the streams are avaliable and I have checked all of them via gstreamer command line tool. I am also sure that the ports given to the pipelines are both different and correct. As for your global naming theory, it looks like the most plausible reason, I will look into it and check if it’s the real reason. Thanks again for your reply.

PS: Also I found an alternative solution, you can use the same pipeline(the one in the Video class) with OpenCV’s VideoCapture class via CAP-_GSTREAMER but the problem is that you need to build OpenCV from source to enable GStreamer support.

Ok, fair enough

Indeed - I made a post about how to do that a while ago :slight_smile: