Pausing/resuming a video recording
Tim Müller
tim at centricular.com
Thu Jul 17 11:35:59 PDT 2014
On Thu, 2014-07-03 at 11:42 +0200, Lee Matthews wrote:
Hi Lee,
> I'm streaming video using the vp8 codec in a webm container. I can
> record the video also by using a tee and piping the video to a
> filesink.
>
> To start/stop recording, I dynamically add/remove a group of elements
> to a tee in the pipeline.
>
> I also wish to be able to pause/resume the recording. I do this using
> output-selector to select between filesink and fakesink, the pipeline
> remaining in the PLAYING state. So when recording normally the video
> goes to filesink, during a pause it goes to fakesink, and on resume it
> goes back to filesink.
>
> My pipeline looks like the following :
>
>
> v4l2sec -- caps filter -- videoconvert -- vp8enc -- webmmux -- tee -- queue -- multisocketsink
> |
> |-----queue -- output-selector -- filesink
> |
> |--------- fakesink
>
>
> If I record a video and say pause the video at 10 seconds, resume the
> video at 20 seconds and stop the video at 30 seconds. When playing back
> all is ok until 10 seconds, then the frame freezes until 20 seconds, at
> which point the video continues ok to 30 seconds.
>
> Does anyone know how to resolve this ?
You could use
tee ! queue ! intervideosink
instead of your output selector stuff, and then have a separate pipeline
in the same process with
intervideosrc ! queue max-size-{time,bytes,buffers}=0 ! encoder !
muxer ! filesink
which you set to paused/playing state as needed.
Alternatively, you could use a valve or pad probe to drop buffers that
you don't want recorded, and either set the pad offset somewhere to
adjust running time backwards (and avoid the picture freezing while you
want it skipped/paused) or adjust the timestamps in a pad probe
yourself.
The first option seems much easier to implement and more robust to me.
Cheers
-Tim
--
Tim Müller, Centricular Ltd - http://www.centricular.com
More information about the gstreamer-devel
mailing list