Save camera to multiple files in real time

Lad, Prabhakar prabhakar.csengg at gmail.com
Wed Oct 25 17:46:33 UTC 2017


On Wed, Oct 25, 2017 at 2:59 AM, redpanda <patrick.landreman at gmail.com> wrote:
> I'm working on an application where I need to capture hours of continuous
> video, and then later upload specific time windows to a remote machine.
> Because the video data is large, and this system will be collecting for
> months, everything has to be compressed.
>
> My first attempt was to use two threads to avoid dropping frames - the first
> has a very simple pipeline with no compression, while the second performs
> the compression. Here is the pipeline I would want to run on the first:
>
> gst-launch-1.0 v4l2src num-buffers=300 ! video/x-raw,framerate=30/1 !
> filesink location=myFile
>
> This command would be run in a loop to capture a sequence of files.
> Unfortunately, while this should capture 300/30 = 10s of video, it takes 30s
> to execute. That means I'm losing a huge amount of video before the next
> iteration of the loop can start.
>

You need to look at multifilesink [1] instead of filesink, set the properties on
when to start a new file. This will make sure it wont drop any frames, and you
dont need to run it in a loop.

[1] https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-multifilesink.html#GstMultiFileSink--max-file-duration

Cheers,
--Prabhakar Lad


More information about the gstreamer-devel mailing list