Counting video frames

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Counting video frames

Darren Staples
Counting video frames 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 ([hidden email]) immediately.  Thank you.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel