number of actual frame

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

number of actual frame

padam
This post was updated on .
Hi, this is my first post. I have to say, that my english isn't well, so you have to forgive me.

So, i am writing a little application in C using Gstreamer, but i don't know how to get information about actual frame. I should be able to check that, when i'm watching movie or listening mp3, or other formats. Another problem is that i would like to get to concrete frame. For example i paused a movie, i check that i'm in 200 frame (it doesn't have to be a keyframe) and i want to tell app that i want to get to 198 frame.

I don't know what to do. i thinking about it over few days, and i can't come up with any idea.
Please for help.
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

Jason Gerard DeRose-2


On Thu, Apr 5, 2012 at 6:42 AM, padam <[hidden email]> wrote:
Hi, this is my first post. I have to say, that my english isn't well, so you
have to forgive me.

So, i am writing a little application in C using Gstreamer, but i don't know
how to get information about actual frame. I should be able to check that,
when i'm watching movie or listening mp3, or other formats. Another problem
is that i would like to get to concrete frame. For example i paused a movie,
i check that i'm in 200 frame (it don't have to be keyframe) and i want to
tell app that i want to get to 198 frame.

GStreamer (generally) deals with everything in terms of nanoseconds. So in theory, all you need is the video's framerate, and then you can create a seek event corresponding to an exact frame, or you can figure out what frame corresponds to a buffer's timestamp.

In practice, how well this works depends on properties of the container format, and the overall correctness of all the GStreamer plugins involved. In my quest for frame accuracy, I've only extensively tested MOV (H.264 video) files from Canon DSLR cameras... but luckily enough, GStreamer deliverers flawless frame-accuracy with this files (well, after I fixed a goof or two in my math).

Note the conversion from nanoseconds to frame is a bit trickier as you'll have to correctly round a floating point value to the nearest integer. You can see how I did both directions in Python here:

http://bazaar.launchpad.net/~novacut/novacut/trunk/view/head:/novacut-thumbnailer#L64

Anyway, I'm totally obsessed with frame-accuracy, so never hesitate to pester me with questions... and I'd love to hear what kind of results you get with the types of video you're working with. I haven't yet done serious tests for the audio equivalent, sample accurate seeking, so I have no idea how well things work there.
 
I don't know what to do. i thinking about it over few days, and i can't come
up with any idea.
Please for help.

--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/number-of-actual-frame-tp4534716p4534716.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

padam
Jason, i know that first a get i number in nanoseconds, but how i can get this number, this is the most important question! I will work with AVI, MSMPEG4 and MP3. Meybe more, not less.

Thanks for your quick help :)
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

Jason Gerard DeRose-2


On Thu, Apr 5, 2012 at 7:16 AM, padam <[hidden email]> wrote:
Jason, i know that first a get i number in nanoseconds, but how i can get
this number, this is the most important question! I will work with AVI,
MSMPEG4 and MP3. Meybe more, not less.

Well, there are a few slightly different ways you can query the total duration, I've got a Python example here, but there are probably better examples:

http://bazaar.launchpad.net/~dmedia/dmedia/trunk/view/head:/dmedia-extract#L79

To get the timestamp of an individual frame, the only way I've done that is in a "handoff" handler for a fakesink element, Python example on line 179:

http://bazaar.launchpad.net/~novacut/novacut/trunk/view/head:/novacut-thumbnailer#L179

I'm not sure there's a very easy way to do this during normal playback, though. Anyone have any ideas?
 
Thanks for your quick help :)

--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/number-of-actual-frame-tp4534716p4534805.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

padam
This post was updated on .
Thanks Jason, you are really helpful! But anybody could give me some example in C? I'm not sure if i will be able to fully understand this code... I have really big trouble with understanding Gstreamer.

And what about switching between single frame? Does anybody know something about that?

EDIT: I have forgotten to write that i work on Windows OS.
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

padam
This post was updated on .
Here is the most important part of the code. I don't know how to rewrite this code from Python to my code:
here was some code...
If anybody could help me, that will be so great...

So, here is great example of using gstreamer. For me - better than manual.

thanks for all
Reply | Threaded
Open this post in threaded view
|

Re: number of actual frame

Stefan Sauer
In reply to this post by padam
On 04/05/2012 02:42 PM, padam wrote:
> Hi, this is my first post. I have to say, that my english isn't well, so you
> have to forgive me.
>
> So, i am writing a little application in C using Gstreamer, but i don't know
> how to get information about actual frame. I should be able to check that,
> when i'm watching movie or listening mp3, or other formats. Another problem
> is that i would like to get to concrete frame. For example i paused a movie,
> i check that i'm in 200 frame (it don't have to be keyframe) and i want to
> tell app that i want to get to 198 frame.
The GST_BUFFER_OFFSET will tell you the framenumber for raw-video and
the sample offset for raw audio. You can also find out about it from an
application by sending a position query with format "default" (might
need some extra work to query it from the right sink; audio or video).

Stefan

> I don't know what to do. i thinking about it over few days, and i can't come
> up with any idea.
> Please for help.
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/number-of-actual-frame-tp4534716p4534716.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel