[gst-devel] Counting video frames

Darren Staples dstaples at friendmts.co.uk
Thu Jan 29 10:15:05 CET 2009


I¹ve come across a problem processing individual frames of a movie using the
appsrc component.

The code in my main loop looks something like this:

if ( !g_queue_is_empty( GST_APP_SINK( sink )->queue ))
  {
    // Get access to raw frame buffer
    GstBuffer *buff = gst_app_sink_pull_buffer( GST_APP_SINK( sink ));
    if ( buff )
    {            
      // Get pointer to frame data
      guint8 *buff_data = (guint8 *)GST_BUFFER_DATA( buff );

      // Do something with buffer here
      
      // Release buffer
      gst_buffer_unref( buff );
      buff = NULL;

      num_frames++;
    }
 }

This works, but if I run it a few times, using the same video each time, I
sometimes see that the number of frames processed is lower than expected.
This happens maybe once in five runs.
I used a gst_app_sink_set_drop( sink , false ) to ensure that the pipeline
stalls if I don¹t pull buffers quickly enough.

Any ideas why or where I might be dropping frames ?

On a similar topic, is there a mechanism within Gstreamer for identifying
the number of frames in a movie file ?

Thanks !

Darren 

*** FRIEND MTS LIMITED EMAIL CONFIDENTIALITY ***

This email message and any attachments may 
contain information which is confidential or privileged 
and is intended for the sole use of the person to 
whom it is addressed.  If you are not the intended 
recipient, be aware that any disclosures, copying, 
distribution or use of the contents is prohibited.  If you 
have received this email message in error, please 
notify our office by telephone (+44 (0)121 633 2000) 
or email (admin at friendmts.co.uk) immediately.  Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090129/b3e5a80d/attachment.htm>


More information about the gstreamer-devel mailing list