Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GSTREAMER access video before an event

I have a SW that performs some video analysis as soon as an event (alarm) happens.

Since I have not enough space on my embedded board, I should start recording the video only when an alarm happens; The algorithm works on a video stored offline (it is not a real time algorithm, so the video should be stored, it doesn't suffice to attach to video stream).

At present time I'm able to attach to video and to store it as soon as I detect the alarm condition. However I would like to analyze the data 10 seconds before the event happens. Is it possible to pre-record up to 10 seconds as a FIFO queue, without storing the whole stream on disk?

I found something similar to my requirements here:

https://developer.ridgerun.com/wiki/index.php/GStreamer_pre-record_element#Video_pre-recording_example

but I would like to know if there is some way I can have the same result, without using the ridgerun tool. Best regards Giovanni

like image 824
Giox79 Avatar asked Oct 18 '25 13:10

Giox79


1 Answers

I think I mixed up my ideas, and both of them seem to be the similar. What I suggest is the following :

  1. Have an element that behaves like ringbuffer, though which you can stream backwards in time. A good example to try out might be the èlement queue. Have a look at time-shift buffering.

  2. Then store the contents to a file on alarm, and use another pipeline that read from it. For eg. use tee or output-selector.

                              | -> ring-buffer
    src -> output-selector -> |   
                              |-> (on alarm) -> ringbuffer + live-src -> file-sink
    

From your question, I understand that your src might be a live camera, and hence doing this can be tricky. Probably you might have to implement your own plugin as done by the RidgeRun team, otherwise this solution is more of a hack rather than a meaningful solution. Sadly there aren't many references for such a solution, you might have to try it out.

like image 144
gst Avatar answered Oct 22 '25 04:10

gst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!