[gst-devel] how to only a frame

Jorge xxopxe at gmail.com
Thu Oct 2 19:32:54 CEST 2008


On Thu, 2008-10-02 at 12:59 +0200, Francesco Argese wrote:
> Hi all
> 
> I'm trying to capture only a frame from my dvcam.
> 

What i did was setting a probe on a pad. When you want to take a frame
you setup the probe, and then in the probe body you save the frame and
remove the probe. Thus a single frame is captured. Something like this
(in python):

def grab_frame(self):
 self.grabprobe = self.grabpad.add_buffer_probe(self.process_frame, []);
        
def process_frame(self, pad, buffer, ret):
 pad.remove_buffer_probe(self.grabprobe)
 #do stuff with buffer
 return True


If you want to save the frame, you can just capture after an encoder
(say jpegenc). Alternativelly you can avoid the encoding bin, and encode
only the captured frame using some other library in the probe itself.
This could be useful if you want encode using say png, which kills the
CPU if you do it on a stream.

Jorge





More information about the gstreamer-devel mailing list