views:

1031

answers:

3

I'm trying to use gstreamer 0.10 from Python to simultaneously display a v4l2 video source and record it to xvid-in-avi. Over a long period of time the computer would be fast enough to do this but if another program uses the disk it drops frames. That's bad enough, but on playback there are bursts of movement in the video where frames were dropped instead of displaying the frames we were able to encode at a lower framerate.

The pipeline is v4l2src ! capsfilter ! tee ! queue ! xvidenc ! avimux ! filesink and the tee also sinks to a queue ! xvimagesink sync=false. I've tried adding videorate in front of xvidenc but that seems to make things worse.

I've considered spooling the uncompressed video to disk in this pipeline and encoding it in a background thread. What else could I do to solve this problem? Is xvidenc or avimux doing the wrong thing with dropped frames? Could I dramatically increase the size of the queue preceding my encoder?

+3  A: 

tee will block if either output blocks, so it's probably your bottleneck. I suggest to write the stream that takes longer to encode to disk and encode from there.

Aaron Digulla
How would you chunk the output so each chunk can be deleted as soon as it has been transcoded?
joeforker
I wound up switching to motion jpeg. The compression is terrible but it doesn't overtax the CPU.
joeforker
A: 

PLz can you tell me how to use pipeline??

Mehdi
+1  A: 

and you need to write xvimagesink, not xvimagesync

luca paciello
a simple speling error
joeforker