How to Stop/start recording using Valve element

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Sep 3 12:28:31 PDT 2013


On Mon, 2013-08-26 at 04:49 -0700, Harish Sakhare wrote:

Hi,

>                        I am sending a video stream using a C920 HD camera as
> an MP2TS stream. I am able to see video on android tablet also I used "tee"
> element to record the video. To start stop video recording I am using
> "valve" element. The default property of valve=FALSE so I used it in my
> pipeline it works well the streaming as well as recording is done. But when
> I used valve = TRUE to stop recording then it stops streaming also.
> Streaming gets stuck just one frame is displayed on the screen.
> 
> Here below is my working pipeline with recording:--
> 
> data->pipeline = gst_parse_launch("udpsrc caps=\"video/mpegts,
> systemstream=(boolean)true, packet-size=(int)188\" ! tsdemux ! h264parse !
> tee name=myvid ! queue ! amcviddec-omxtiducati1videodecoder ! eglglessink
> myvid. ! queue ! filesink location=/storage/sdcard0/Movies/Test.mp4",
> &error);
> 
> Here below is my pipeline where streaming gets STUCK:-
> 
> data->pipeline = gst_parse_launch("udpsrc caps=\"video/mpegts,
> systemstream=(boolean)true, packet-size=(int)188\" ! tsdemux ! h264parse !
> tee name=myvid ! queue ! amcviddec-omxtiducati1videodecoder ! eglglessink
> myvid. ! valve drop = true ! queue ! filesink
> location=/storage/sdcard0/Movies/Test.mp4",
> &error);

If you do it like this, it won't even preroll, so gets stuck in
prerolling. The reason for that is that the initial preroll mechanism
requires each sink to receive at least one buffer (so it can go to
playing immediately when required).

If you use drop=true on valve, all buffers will be dropped on that
branch, and no buffers will make it to the filesink, so the filesink
will never preroll.

You can work around that by setting the "async" property on filesink to
FALSE, then the pipeline will not care whether filesink receives buffers
or not.

Overall, however, I would recommend that you add the recording branch
dynamically at runtime, when required, and then unlink + remove it again
later when done. Note that you'll have to push an EOS manually into the
recording branch to finish up recording properly (in case you ever add a
muxer; you are not actually outputting an 'mp4' file here).

 Cheers
  -Tim

> 
> So please any one guide how to use Valve to stop recording and how I used it
> in my pipeline.
> I would appreciate any help for my problem.
> 
> 
> 
> 
> 
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/How-to-Stop-start-recording-using-Valve-element-tp4661728.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




More information about the gstreamer-devel mailing list