Gstremer Delayed Streaming Video

Is it possible to set some delay between sending demultiplexed, decoded h264 output to autovideosink in the gstreamer pipeline. If so, someone can send a sample conveyor. The pipeline I used is udpsrc port = 5000! mpegtsdemux name = demux! turn! ffdec_h264! ffmpegcolorspace! autovideosink demux.! turn! ffdec_mp3! audio converter! alsasink demux

In this case, as soon as the stream is received in the update window 5000, it will immediately begin playback after decoding using demultiplexing. Is there any possibility of delay telling 60sec befoe sending him autovideosink where he actually played. Is there any Gstreamer plugin / element for this.

+4
source share
2 answers

You can see the queue options (run gst-inspect queue ):

 max-size-buffers : Max. number of buffers in the queue (0=disable) flags: lesbar, schreibbar Unsigned Integer. Range: 0 - 4294967295 Default: 200 max-size-bytes : Max. amount of data in the queue (bytes, 0=disable) flags: lesbar, schreibbar Unsigned Integer. Range: 0 - 4294967295 Default: 10485760 max-size-time : Max. amount of data in the queue (in ns, 0=disable) flags: lesbar, schreibbar Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 1000000000 min-threshold-buffers: Min. number of buffers in the queue to allow reading (0=disable) flags: lesbar, schreibbar Unsigned Integer. Range: 0 - 4294967295 Default: 0 min-threshold-bytes : Min. amount of data in the queue to allow reading (bytes, 0=disable) flags: lesbar, schreibbar Unsigned Integer. Range: 0 - 4294967295 Default: 0 min-threshold-time : Min. amount of data in the queue to allow reading (in ns, 0=disable) flags: lesbar, schreibbar Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 

By setting min-threshold-time , you can delay output by n nanoseconds.
I just tried this with my webcam and it worked (delay 60 seconds):

 gst-launch v4l2src ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 min-threshold-time=60000000000 ! autovideosink 

Please note that I set the max-size-* parameters to 0, because if the queue is filled before the threshold is completed, you will not receive data from the queue.

And keep in mind that the order of the decoded video stream can lead to huge memory usage. With your encoded udpsrc, I would recommend delaying the h264 encoded stream. You may need to set the threshold in bytes instead of nanoseconds (I don’t think that the queue knows enough about the encoded data to guess the bitrate).

+4
source

My solution was to add a delay to autoaudiosink. Great feature, critically called ts-offset:

 $ gst-launch-1.0 souphttpsrc location=http://server:10000/ ! queue \ max-size-bytes=1000000000 max-size-buffers=0 max-size-time=0 ! \ decodebin ! autoaudiosink ts-offset=500000000 

min-threshold- * didn't work for me.

The delay works. Sync disabled:

 $ gst-launch-1.0 souphttpsrc location=http://server:10000/ ! \ decodebin ! autoaudiosink sync=false 

For music, for example, for what I use for it, synchronization does not really matter, except that a nice next song arrives sooner rather than later when you change tracks. Therefore, I still prefer half the delay.

When you turn off synchronization, as a rule, the stream slowly crashes. For a stream in real time, the data of which is generated in real time, the synchronization of the stream can be supported by requesting a queue for downloading additional data:

 gst-launch-1.0 souphttpsrc location=http://server:10000/ ! \ queue max-size-bytes=65536 max-size-buffers=0 max-size-time=0 \ leaky=downstream ! decodebin ! autoaudiosink sync=false 

This allows you to synchronize the stream within 64KiB when the data was first provided on the server. This turned out to be my preferred solution, because I broadcast data that was generated in real time using a computer sound card on the same Wi-Fi network. This is for live streaming only. This will not work if the stream data was predetermined, in which case the entire stream will be loaded as quickly as possible, as a result of which everything will run more or less quickly.

+1
source

Source: https://habr.com/ru/post/1484974/


All Articles