Gstreamer timestamps with start/stop recording

Nicolas Dufresne nicolas at
Wed Aug 17 14:34:26 UTC 2022

Hi Terry,

Le mercredi 17 août 2022 à 14:07 +0100, Terry Barnaby via gstreamer-devel a
écrit :
> videotestsrc pattern=smpte ! 
> video/x-raw,width=640,height=480,framerate=5/1 ! c.sink_0
> appsrc name="appsrc" ! imagefreeze ! videoconvert ! c.sink_1
> t. ! queue ! glimagesink name=videoSink
> t. ! queue ! fakesink enable-last-sample=true name=picturestream"
> t. ! queue ! beamvalve name=recordValve drop=true ! vaapih264enc 
> name=recordEncoder ! h264parse ! mp4mux fragment-duration=10 ! filesink 
> append=true location="video.mp4" async=false
> This pipeline is created in software and the recordValve is set to drop 
> or not the video frames to disable/enable recording to the file.

its been my recommendation for a while now, and have worked for my projects
also. For recording purposed, I keep recommending using a separate "offline"
pipeline. End a branch of your live pipeline with appsink, and create the
offline pipeline starting with the appsrc. You can then pass the samples from
you application, which gives you the opportunity to redo or offset the timing if
needed. It also makes the closing of the recording way simpler.


p.s. don't forget to discard the buffer from you appsink(s) while not recording

More information about the gstreamer-devel mailing list