How to reduce bandwidth with videomixer

Why do I use vieomixer elements to merge video streams, but the bandwidth increases proportionally, I want to combine multiple streams into one, and then use the bandwidth of one channel for transmission, what should I do

Not quite sure what you mean, could you provide more details about what you’re doing exactly?

Also, you should be using compositor or glvideomixer nowadays, videomixer is old and deprecated.

My processing scenario is: Four cameras are connected to a host, and rtsp push-pull stream is carried out through gst. If push-pull stream is carried out through four single channels, the bandwidth occupancy of one pull stream is 2M, and four channels are 2*4=8M. I would like to use videomixer or compositor to merge four videos into one first. Then push and pull streams, so whether only use one bandwidth or two bandwidth

Still not quite clear to me what you mean exactly, sorry.

Do you want to create a 2x2 grid of the 4 input streams?

With each input downscaled to a lower resolution? Or just re-encode the combined streams with a different bitrate?

Yes, I would like to create a 2*2 grid with videomixer and then push and pull streams through rtsp. Does this reduce the transmission bandwidth compared to four single video streams? How can I reduce the bandwidth when transmitting a 4-way video over rtsp

More directly, is there a way for gst to reduce the bandwidth of video transmission

Yes. For raw video you can reduce bandwidth by:

  • reducing the resolution
  • reducing the framerate
  • using a pixel format with different subsampling

For encoded video output you can reduce bandwidth with all of the above on the raw side plus:

  • re-encoding to a different target bitrate (with same or different codec)

I would like to ask what is the principle of videomixer element and compositor element, how does it combine multiple videos? Or where should I look up the rationale and explanation of these elements?

Have you looked at the compositor documentation yet?

Yes, I have, but I have not seen the design idea of the compositor, the implementation logic, that is, the specific details of merging video streams, how to merge multiple video streams into a pipeline, what is the implementation logic of the fusion between video streams

compositor is based on the GstVideoAggregator base class

The implementation logic can be found in the implementation :slightly_smiling_face:

The way it works is that the compositor decides an output resolution + format + framerate (resolution is based on the largest input stream I think, but you can probably also force a different one with a capsfilter).

Then the compositor will generate an output frame for a given timestamp (in running time) according to the output framerate.

It will look at the inputs buffers on the input pads and figure out the running time for each of them and which buffer overlaps with the desired output buffer timestamp. If an input buffer is too old it will be dropped off and the next input buffer will be looked at.

You can position/scale the input videos with the properties on the input pads if you like. See gst-inspect-1.0 compositor

Well, I’ll try to make sense of it

Hello, excuse me. Could you help me analyze this problem, which also involves bandwidth