I want to retrieve the duration of a video file in frames, but can't
figure out the best way to do this. Calling... GstFormat fmt = GST_FORMAT_DEFAULT; gst_element_query_duration( _pipeline, &fm, &numFrames) ...doesn't work. I'm assuming because the pipeline doesn't know about the "default format" (GST_FORMAT_TIME works fine). Which element in my pipeline should I query for the number of video frames? Is this even possible. Currently I am building a pipeline using decodebin. Thanks, -Nick ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Feb 19, 2008 11:48 PM, Nick Haddad <[hidden email]> wrote:
> I want to retrieve the duration of a video file in frames, but can't > figure out the best way to do this. > > Calling... > > GstFormat fmt = GST_FORMAT_DEFAULT; > gst_element_query_duration( _pipeline, &fm, &numFrames) > > ...doesn't work. I'm assuming because the pipeline doesn't know about > the "default format" (GST_FORMAT_TIME works fine). > > Which element in my pipeline should I query for the number of video > frames? Is this even possible. Currently I am building a pipeline > using decodebin. Do you need it at any point in time or would it be OK at the end of the playback? -- Felipe Contreras ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Nick Haddad
On Tue, 2008-02-19 at 16:48 -0500, Nick Haddad wrote: > I want to retrieve the duration of a video file in frames, but can't > figure out the best way to do this. > > Calling... > > GstFormat fmt = GST_FORMAT_DEFAULT; > gst_element_query_duration( _pipeline, &fm, &numFrames) > > ...doesn't work. I'm assuming because the pipeline doesn't know about > the "default format" (GST_FORMAT_TIME works fine). > > Which element in my pipeline should I query for the number of video > frames? Is this even possible. Currently I am building a pipeline > using decodebin. > You could probably get the time duration and then use the framerate to get the number of frames. This only works if the file has a constant framerate, of course. A better alternative it to just implement the DEFAULT query in the relevant elements (quite trivial for avi/qt demuxers). Wim > Thanks, > -Nick > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Felipe Contreras
I really need to get this information before playback starts. I want
to present the user with the frame count after they open a file. If there is no generalized way to do do this (by asking the decode bin?) Is there a way seek through by frames without decoding the video in the files? If there is then I can do a quick walk through frame by frame to do my count. Thanks, -Nick On Feb 20, 2008, at 5:54 AM, Felipe Contreras wrote: > On Feb 19, 2008 11:48 PM, Nick Haddad <[hidden email]> wrote: >> I want to retrieve the duration of a video file in frames, but can't >> figure out the best way to do this. >> >> Calling... >> >> GstFormat fmt = GST_FORMAT_DEFAULT; >> gst_element_query_duration( _pipeline, &fm, &numFrames) >> >> ...doesn't work. I'm assuming because the pipeline doesn't know >> about >> the "default format" (GST_FORMAT_TIME works fine). >> >> Which element in my pipeline should I query for the number of video >> frames? Is this even possible. Currently I am building a pipeline >> using decodebin. > > Do you need it at any point in time or would it be OK at the end of > the playback? > > -- > Felipe Contreras ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Anyone else have ideas on how to best do this?
Thanks, -Nick On Feb 20, 2008, at 9:53 AM, Nick Haddad wrote: > I really need to get this information before playback starts. I want > to present the user with the frame count after they open a file. > > If there is no generalized way to do do this (by asking the decode > bin?) Is there a way seek through by frames without decoding the video > in the files? If there is then I can do a quick walk through frame by > frame to do my count. > > Thanks, > -Nick > > On Feb 20, 2008, at 5:54 AM, Felipe Contreras wrote: > >> On Feb 19, 2008 11:48 PM, Nick Haddad <[hidden email]> wrote: >>> I want to retrieve the duration of a video file in frames, but can't >>> figure out the best way to do this. >>> >>> Calling... >>> >>> GstFormat fmt = GST_FORMAT_DEFAULT; >>> gst_element_query_duration( _pipeline, &fm, &numFrames) >>> >>> ...doesn't work. I'm assuming because the pipeline doesn't know >>> about >>> the "default format" (GST_FORMAT_TIME works fine). >>> >>> Which element in my pipeline should I query for the number of video >>> frames? Is this even possible. Currently I am building a pipeline >>> using decodebin. >> >> Do you need it at any point in time or would it be OK at the end of >> the playback? >> >> -- >> Felipe Contreras > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, 2008-02-21 at 09:49 -0500, Nick Haddad wrote: > Anyone else have ideas on how to best do this? Go to PAUSED, wait for paused to happen by listening to the ASYNC_DONE message or by polling or by doing a blocking gst_element_get_state(). Then you can get all the info. Wim > > Thanks, > -Nick > > On Feb 20, 2008, at 9:53 AM, Nick Haddad wrote: > > > I really need to get this information before playback starts. I want > > to present the user with the frame count after they open a file. > > > > If there is no generalized way to do do this (by asking the decode > > bin?) Is there a way seek through by frames without decoding the video > > in the files? If there is then I can do a quick walk through frame by > > frame to do my count. > > > > Thanks, > > -Nick > > > > On Feb 20, 2008, at 5:54 AM, Felipe Contreras wrote: > > > >> On Feb 19, 2008 11:48 PM, Nick Haddad <[hidden email]> wrote: > >>> I want to retrieve the duration of a video file in frames, but can't > >>> figure out the best way to do this. > >>> > >>> Calling... > >>> > >>> GstFormat fmt = GST_FORMAT_DEFAULT; > >>> gst_element_query_duration( _pipeline, &fm, &numFrames) > >>> > >>> ...doesn't work. I'm assuming because the pipeline doesn't know > >>> about > >>> the "default format" (GST_FORMAT_TIME works fine). > >>> > >>> Which element in my pipeline should I query for the number of video > >>> frames? Is this even possible. Currently I am building a pipeline > >>> using decodebin. > >> > >> Do you need it at any point in time or would it be OK at the end of > >> the playback? > >> > >> -- > >> Felipe Contreras > > > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by: Microsoft > > Defy all challenges. Microsoft(R) Visual Studio 2008. > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > > _______________________________________________ > > gstreamer-devel mailing list > > [hidden email] > > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
I understand how to get the duration in nanonseconds after pausing a
pipeline, that is working fine in my code. But asking for frames is a little trickier, especially for variable frame rate files, which I would like to support. Should I be trying to ask the decodebin for the duration in frames? Is the file source a better element to ask? Thanks for your help, -nick On Feb 21, 2008, at 9:57 AM, Wim Taymans wrote: > > On Thu, 2008-02-21 at 09:49 -0500, Nick Haddad wrote: >> Anyone else have ideas on how to best do this? > > Go to PAUSED, wait for paused to happen by listening to the ASYNC_DONE > message or by polling or by doing a blocking gst_element_get_state(). > Then you can get all the info. > > Wim > >> >> Thanks, >> -Nick >> >> On Feb 20, 2008, at 9:53 AM, Nick Haddad wrote: >> >>> I really need to get this information before playback starts. I >>> want >>> to present the user with the frame count after they open a file. >>> >>> If there is no generalized way to do do this (by asking the decode >>> bin?) Is there a way seek through by frames without decoding the >>> video >>> in the files? If there is then I can do a quick walk through >>> frame by >>> frame to do my count. >>> >>> Thanks, >>> -Nick >>> >>> On Feb 20, 2008, at 5:54 AM, Felipe Contreras wrote: >>> >>>> On Feb 19, 2008 11:48 PM, Nick Haddad <[hidden email]> >>>> wrote: >>>>> I want to retrieve the duration of a video file in frames, but >>>>> can't >>>>> figure out the best way to do this. >>>>> >>>>> Calling... >>>>> >>>>> GstFormat fmt = GST_FORMAT_DEFAULT; >>>>> gst_element_query_duration( _pipeline, &fm, &numFrames) >>>>> >>>>> ...doesn't work. I'm assuming because the pipeline doesn't know >>>>> about >>>>> the "default format" (GST_FORMAT_TIME works fine). >>>>> >>>>> Which element in my pipeline should I query for the number of >>>>> video >>>>> frames? Is this even possible. Currently I am building a >>>>> pipeline >>>>> using decodebin. >>>> >>>> Do you need it at any point in time or would it be OK at the end of >>>> the playback? >>>> >>>> -- >>>> Felipe Contreras >>> >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by: Microsoft >>> Defy all challenges. Microsoft(R) Visual Studio 2008. >>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >>> _______________________________________________ >>> gstreamer-devel mailing list >>> [hidden email] >>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2008. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> gstreamer-devel mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
In reply to this post by Nick Haddad
In order to determine the number of frames in a video file via the API by provided by OpenCV, we need to utilize what are called capture properties, or what OpenCV calls CAP_PROP — anytime you see a constant starting with CAP_PROP_* , you should know it's related to video processing.
|
Free forum by Nabble | Edit this page |