[gst-devel] Problems recording video from live pipeline

Daniel Drake dsd at laptop.org
Wed Jul 9 16:16:09 CEST 2008


Hi,

I'm working on OLPC's Record activity:
http://wiki.laptop.org/go/Record
This is a gstreamer-based application which allows the user to take
photos, record audio, and record videos (audio+video).

The app shows a live video feed from the webcam, then the user can click
buttons to start recording audio/video/photo.

For the visuals, the always-running pipeline is:
v4l2src -> tee -> queue -> xvimagesink

To take a photo, I add a custom photo-taking bin onto the tee (and
remove it after it has taken a photo). This works fine, while the
pipeline is running (I'm doing pad blocking and the like).

However, doing something similar for video is harder. My video bin is:
queue -> videorate -> videoscale -> ffmpegcolorspace -> theoraenc
-> oggmux -> filesink
and again, I add this onto the tee while the pipeline is running to
start recording video.

This works, except the first frame of the recorded video is frozen for
2-5 seconds. When an audio-recording bin is added to the pipeline as
well, the video freeze delay increases to 5-10 seconds.
If I stop the pipeline while I am adding those video/audio-recording
elements, and then start it when done, the recorded output is fine.

Also, interestingly, if I remove those elements from the running
pipeline (when we're done with the recording), the live video feed shown
on screen becomes delayed by 5 seconds or so. Weird! Again, if I stop
the pipeline while removing the elements and then start it again,
everything is fine.

Here is a slimmed down program which shows the issue:
http://dev.laptop.org/~dsd/recordogg.txt
It starts displaying the webcam on screen, waits a few seconds, then
starts recording, stops recording after a few more seconds and then 
exits. If you don't have a webcam then you can substitute videotestsrc
for v4l2src and see the same problem.

Here is an output video which shows the issue:
http://dev.laptop.org/~dsd/output.ogg (60kb)
My hand was moving the entire time the program was running, however the
video shows it frozen for about 3 seconds at the start.

I've worked around this by stopping the pipeline when messing with its
structure, but I'm happy to run further tests and try patches if anyone
has ideas...

Thanks,
Daniel






More information about the gstreamer-devel mailing list