Timelapse from RTSP stream

Hello everyone

Question - given nano, a 720p RTSP stream from a remote webcam, how one can create timelapse using nano and save jpg files locally?


1 Like

This will save one frame per second into jpg:

mkdir test
cd test
gst-launch-1.0 uridecodebin uri=rtsp:// ! nvvidconv ! videorate ! video/x-raw, framerate=1/1 ! jpegenc ! multifilesink location=./frame%06d.jpg

Be sure to stop it before it fills your filesystem.

Then you can create a video file with timelapse accelerating to 30 fps with:

gst-launch-1.0 -e multifilesrc location="frame%06d.jpg" caps="image/jpeg,framerate=30/1" ! jpegdec ! omxh264enc ! matroskamux ! filesink location=timelapse.mkv
1 Like

Great, thank you. I guess framerate=1/1 is the parameter that dictates how often the frames are saved. How do I change the save rate to once per 1m/5m/10m?

Also somehow the related questions below. If given the above RTSP stream, how can I setup the following:

  • Motion detection and start saving the stream into an h264 encoded mp4 file until ‘motion’ stops?
  • How do I define what ‘motion’ is?
  • Object recognition (and related activity - I guess - training) and as above start saving the stream into disk when something fitting a predefined ‘object’ -like ‘cat’, ‘a person’, ‘a bird’ - comes into the stream?

Thank you.

P.S. Hope you can guide a person who is very new to the field. :)

1/60 would be one frame per minute.

Thanks again.