keyframes from a video

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

keyframes from a video

kitone
Hi,

I'm the developer of subtitleeditor[1] and i'm currently rewriting the
gstreamer support. I need to display the position of the keyframes on
the waveform, and for that I need to extract all keyframes from a video
and keep this values in a array.

My current method is to play the video something like this:

'filesrc ! decodebin ! ffmpegcolorspace ! fakesink'

Connect the 'handoff' signal of my fakesink and check if the buffer has
a flag GST_BUFFER_FLAG_DELTA_UNIT. If yes, add a keyframe in an array.

It work pretty well, but it's also a little slow. Is there an another
way to get all keyframes from a video?

[1] http://home.gna.org/subtitleeditor

Best regards,
kitone

------------------------------------------------------------------------------
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: keyframes from a video

kitone
Hi all,
unanswered, do I need to consider there is not an another way to get
keyframes from a file with gstreamer?

Thanks & best regards,
kitone

Le Fri, 24 Jul 2009 11:20:04 +0200,
kitone <[hidden email]> a écrit :

> Hi,
>
> I'm the developer of subtitleeditor[1] and i'm currently rewriting the
> gstreamer support. I need to display the position of the keyframes on
> the waveform, and for that I need to extract all keyframes from a
> video and keep this values in a array.
>
> My current method is to play the video something like this:
>
> 'filesrc ! decodebin ! ffmpegcolorspace ! fakesink'
>
> Connect the 'handoff' signal of my fakesink and check if the buffer
> has a flag GST_BUFFER_FLAG_DELTA_UNIT. If yes, add a keyframe in an
> array.
>
> It work pretty well, but it's also a little slow. Is there an another
> way to get all keyframes from a video?
>
> [1] http://home.gna.org/subtitleeditor
>
> Best regards,
> kitone
>
> ------------------------------------------------------------------------------
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: keyframes from a video

Tim-Philipp Müller-2
In reply to this post by kitone
On Fri, 2009-07-24 at 11:20 +0200, kitone wrote:

Hi,

> I'm the developer of subtitleeditor[1] and i'm currently rewriting the
> gstreamer support. I need to display the position of the keyframes on
> the waveform, and for that I need to extract all keyframes from a video
> and keep this values in a array.
>
> My current method is to play the lvideo something like this:
>
> 'filesrc ! decodebin ! ffmpegcolorspace ! fakesink'
>
> Connect the 'handoff' signal of my fakesink and check if the buffer has
> a flag GST_BUFFER_FLAG_DELTA_UNIT. If yes, add a keyframe in an array.
>
> It work pretty well, but it's also a little slow.

There are a couple of problems with this approach:

 - if GST_BUFFER_FLAG_DELTA_UNIT is set this means that the buffer does
*not* contain a key frame

 - decodebin outputs decoded raw video frames; I don't think the
semantics of keyframe/not-keyframe are very well defined for raw video
frames. I would not rely on decoders flagging their output buffers
consistently one way or another or at all

 - you are likely to get better results if you check for keyframes on
buffers before they go into the decoder

> Is there an another way to get all keyframes from a video?

 - I guess GstIndex would theoretically be the right way to get to this
kind of information (idea is that demuxer or whatever populate the index
object with the information), but I don't think this is supported very
well, or at all, in most of our elements. Not sure what plans are here
(ie. if GstIndex support should be implemented widely, or if a new API /
mechanism should be found etc.)

 Cheers
  -Tim


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: keyframes from a video

kitone
Hi,

>  - if GST_BUFFER_FLAG_DELTA_UNIT is set this means that the buffer
> does *not* contain a key frame

Yes, I've make a mistake in my explanation. It's more like that:
 
if(!buffer->flag_is_set(Gst::BUFFER_FLAG_DELTA_UNIT))
{
  // it's a keyframe
}

>
>  - decodebin outputs decoded raw video frames; I don't think the
> semantics of keyframe/not-keyframe are very well defined for raw video
> frames. I would not rely on decoders flagging their output buffers
> consistently one way or another or at all
>
>  - you are likely to get better results if you check for keyframes on
> buffers before they go into the decoder
>
> > Is there an another way to get all keyframes from a video?
>
>  - I guess GstIndex would theoretically be the right way to get to
> this kind of information (idea is that demuxer or whatever populate
> the index object with the information), but I don't think this is
> supported very well, or at all, in most of our elements. Not sure
> what plans are here (ie. if GstIndex support should be implemented
> widely, or if a new API / mechanism should be found etc.)
>
>  Cheers
>   -Tim

So from what you said, my current solution can be improve and it's
currently the only one, since the GstIndex is not used and there is not
really a specialized API for this.

I will try to make improvements from your comments, thanks.

Best regards,
kitone

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel