[gst-devel] Discarding Frames

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Jun 4 00:27:07 CEST 2010


On Thu, 2010-06-03 at 15:08 -0700, Wes Miller wrote:

> I would like to process an mjpeg stream stored in a  matroska container file
> to build a new file with fewer frames in it.  Specifically, I have a list of
> random frames I want to keep.  
> 
> This feels like a good use for appsink, but will discarding frames mess up
> the header info?  
> 
> I suppose the header comes through the appsink first as the first (more?)
> frame. 
> 
> Can I 1use the caps to detect header from image frame?  
> 
> Will I need to dissect my header and adjust it?  
> 
> Where might I find specs to follow?

You could use a pipeline such as e.g. matroskademux ! queue ! capsfilter
caps=image/jpeg ! matroskamux and then set up a buffer probe on the
capsfilter's sink pad (there may not be any need for the queue or the
capsfilter). Whenever a buffer is pushed through, your probe callback
will be called and you can decide whether the buffer should be dropped
or kept by returning TRUE or FALSE.

Alternatively, just write a small element that does the same thing and
either pushes out the buffer it receives in its chain function or drops
it.

Cheers
 -Tim





More information about the gstreamer-devel mailing list