Thank you very much Arnout. <br><br>Using the method you described I am able to record from the webcam every time the user presses a button. As you pointed, also, I am having trouble with timestamps. In my case, since I just need to record one file at time, I would be ok to reset the base time for the v4l2src element. However ,when I try to set the base_time to 0 for this element it stops streaming new images.<br>
<br>Since I'd like to stick to the "default" gstreamer packages, is there a way to set the base_time for v4l2src without it being stopped ?<br><br>Thanks<br><br><div class="gmail_quote">2009/1/31 Arnout Vandecappelle <span dir="ltr"><<a href="mailto:arnout@mind.be">arnout@mind.be</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">On Friday 30 January 2009 20:37:49 Marc wrote:<br>
> I am trying to build an application more or less like Cheese<br>
> (<a href="http://projects.gnome.org/cheese/" target="_blank">http://projects.gnome.org/cheese/</a>). However I would like to switch from<br>
> just showing the webcam to a recording state "smoothly" when the user press<br>
> the record button.<br>
><br>
> So far I have tried the following approaches without succes:<br>
> Changing location property of filesink while playing (from /dev/null to a<br>
> real path). This is not possible (filesink tells me so). Open 2 different<br>
> pipelines both of them pointing to the same v4l2src (no success since only<br>
> one pipeline can access the webcam at once). Since these approaches were<br>
> not working I tried to set the pipeline to STATE_NULL, change the location<br>
> of the filesink, and then set the pipeline to STATE_PLAYING again. However,<br>
> when setting the pipeline to STATE_NULL, no STATE_CHANGE event is thrown.<br>
> Is this the expected behavior ?<br>
><br>
> Any ideas ? Can the smooth "play-to-record" be accomplished with GStreamer<br>
> ?<br>
><br>
> Thank you<br>
> PD. For the record: I am programming in Python and the pipeline I am trying<br>
> to manage is the following:<br>
><br>
> gst-launch-0.10 v4l2src ! tee name=videoout ! queue ! videorate !<br>
> video/x-raw-yuv,fps=15 ! queue ! theoraenc quality=60 ! queue ! muxout.<br>
> pulsesrc ! audio/x-raw-int,rate=22000,channels=1,width=16 ! queue !<br>
> audioconvert ! vorbisenc ! queue ! muxout. oggmux name=muxout ! filesink<br>
> location=test.ogg videoout. ! queue ! ffmpegcolorspace ! ximagesink<br>
<br>
</div></div> You can add the videoout tail of the pipeline dynamically. Start without it,<br>
and when the user presses the record button, add it to the pipeline and link<br>
it (and set each element to PLAYING individually). It's not even necessary<br>
to pause the pipeline.<br>
<br>
It's more difficult to smoothly stop the recording, though. You'll have to<br>
block the queue element behind the tee (see docs/design/part-block.txt in the<br>
source tree). In addition, you have to push an EOS into it to make sure the<br>
muxer writes duration and index to the file.<br>
<br>
A last caveat is the timestamps. The buffer timestamps start running as soon<br>
as the v4l2src starts playing, which makes it appear in the output file as if<br>
it starts with a big hole. The only way I found to fix that is to add an<br>
adapter element that shifts the buffer timestamps (see<br>
<a href="http://bugzilla.gnome.org/show_bug.cgi?id=561224" target="_blank">http://bugzilla.gnome.org/show_bug.cgi?id=561224</a> ).<br>
<br>
Regard,<br>
Arnout<br>
--<br>
Arnout Vandecappelle arnout at mind be<br>
Senior Embedded Software Architect +32-16-286540<br>
Essensium/Mind <a href="http://www.mind.be" target="_blank">http://www.mind.be</a><br>
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven<br>
LinkedIn profile: <a href="http://www.linkedin.com/in/arnoutvandecappelle" target="_blank">http://www.linkedin.com/in/arnoutvandecappelle</a><br>
GPG fingerprint: D206 D44B 5155 DF98 550D 3F2A 2213 88AA A1C7 C933<br>
<br>
------------------------------------------------------------------------------<br>
This SF.net email is sponsored by:<br>
SourcForge Community<br>
SourceForge wants to tell your story.<br>
<a href="http://p.sf.net/sfu/sf-spreadtheword" target="_blank">http://p.sf.net/sfu/sf-spreadtheword</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Marc S.<br>