<HTML>
<HEAD>
<TITLE>Counting video frames</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>I&#8217;ve come across a problem processing individual frames of a movie using the appsrc component.<BR>
<BR>
The code in my main loop looks something like this:<BR>
<BR>
if ( !g_queue_is_empty( GST_APP_SINK( sink )-&gt;queue ))<BR>
&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;// Get access to raw frame buffer<BR>
&nbsp;&nbsp;&nbsp;&nbsp;GstBuffer *buff = gst_app_sink_pull_buffer( GST_APP_SINK( sink ));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if ( buff )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get pointer to frame data<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;guint8 *buff_data = (guint8 *)GST_BUFFER_DATA( buff );<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Do something with buffer here<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Release buffer &nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gst_buffer_unref( buff );<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buff = NULL;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;num_frames++; &nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;}<BR>
<BR>
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.<BR>
I used a gst_app_sink_set_drop( sink , false ) to ensure that the pipeline stalls if I don&#8217;t pull buffers quickly enough.<BR>
<BR>
Any ideas why or where I might be dropping frames ?<BR>
<BR>
On a similar topic, is there a mechanism within Gstreamer for identifying the number of frames in a movie file ?<BR>
<BR>
Thanks !<BR>
<BR>
Darren </SPAN></FONT>
<!--[object_id=#friendmts.co.uk#]--><FONT color=#0000ff>
<P align=left><FONT face=Tahoma color=#0000ff size=2><FONT size=3>&nbsp;</FONT></P>
<P align=left>*** FRIEND MTS LIMITED&nbsp;EMAIL CONFIDENTIALITY ***</FONT></P>
<P align=left><FONT color=#0000ff><FONT face=Tahoma size=2>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.&nbsp; If you are not the intended recipient, be aware that any disclosures, copying, distribution or use of the contents is prohibited.&nbsp; If you have received this email message in error, please notify our office by telephone (+44 (0)121 633 2000) or email (</FONT><A href="mailto:admin@friendmts.co.uk"><FONT face=Tahoma size=2>admin@friendmts.co.uk</FONT></A><FONT face=Tahoma size=2>) immediately.&nbsp; Thank you.</FONT></FONT></P></FONT></BODY>
</HTML>