Motion detection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Motion detection

luke
Hi all,

I would like to use gstreamer through the CLI to store a video when motion is detected but I don't know how to configure the sink to store the images only if a motion is detected. Something like:

gst-launch-1.0 v4l2src ! videoconvert ! motioncells ! ???

I don't care about the cells themselves. Actually, I would rather not have them rendered on the stored file.

Any idea how to do this?

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Motion detection

Nicolas Dufresne-5
Le mardi 05 septembre 2017 à 11:20 +0000, luke a écrit :
> I would like to use gstreamer through the CLI to store a video when
> motion is detected but I don't know how to configure the sink to
> store the images only if a motion is detected. Something like:
>
> gst-launch-1.0 v4l2src ! videoconvert ! motioncells ! ???
>
> I don't care about the cells themselves. Actually, I would rather not
> have them rendered on the stored file.

You'll need to program something, gst-launch-1.0 does not have support
for changing the stream upon a message. Programatically, you'll need to
watch for element messages on the bus. The simplest is to use a tee,
when there is activity, create a new branch on the tee. When activity
ends, disconnect the branch, push an EOS and discard.

regards,
Nicolas

p.s. An example monitor pipeline, with a statically connect recording
branch for demonstration:

gst-launch-1.0 -em pipeline. \( latency=200000000 v4l2src ! tee name=t
! queue ! jpegdec ! video/x-raw,framerate=15/1,width=352 ! videoconvert
! queue ! motioncells display=1 ! queue !  glimagesink t. ! queue !
qtmux ! filesink location=test.mov \)
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel