Reading frame numbers in a local video file with precision
Kenneth Feingold
kjfeingold at gmail.com
Wed Jan 17 19:55:07 UTC 2024
Hi Will,
Thanks very much for working with me on this, to whatever limit extent is
possible :-)
My application has a very simple pipeline. It uses playbin to show a video
file in a gtkgl window:
data.playbin = gst_element_factory_make ("playbin", "playbin");
videosink = gst_element_factory_make ("glsinkbin", "glsinkbin");
gtkglsink = gst_element_factory_make ("gtkglsink", "gtkglsink");
When I seek to a frame like this:
gst_element_seek_simple (data->playbin, GST_FORMAT_DEFAULT,
GST_SEEK_FLAG_FLUSH |GST_SEEK_FLAG_KEY_UNIT, 12345);
send_seek_event (data);
/*and then in my seek function:*/
gst_element_send_event (data->video_sink, seek_event);
It actually takes me to precise frame #12345.
But, when I try to retrieve frame numbers while playing the file:
/* Query the current position in frames */
if (gst_element_query_position (data->playbin, GST_FORMAT_DEFAULT,
¤t)) {
framenum=(current/1599.49);
g_print ("Current Frame: %ld\n", framenum);
}
I need to use that specific (kludge) factor "framenum=(current/1599.49);"
in order to get *close* to the app giving me the right frame number. What
is curious is that with a different video file having a different length I
need to use a different divisor to get the "right" value. Is this related
to media duration/stream time?
I am working with mp4 and mov files, and I am wondering if compression
between frames is a factor? Would uncompressed video yield greater accuracy?
And, as I was wondering in my earlier post here, what values do you think
this:
gst_element_query_position (data->playbin, GST_FORMAT_DEFAULT, ¤t))
is giving me (without my kludge)?
Thanks again!
Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20240117/32708031/attachment.htm>
More information about the gstreamer-devel
mailing list