How to get the last frame of a video file ?
Sebastian Dröge
sebastian at centricular.com
Sat Jan 25 08:16:59 PST 2014
On Sa, 2014-01-25 at 05:59 -0800, adrien_sch wrote:
> [...]
> At this point, we are sure that this frame exist in the video file, at
> position 56500000000.
>
> Now, let seek in this file using the matroskademux.
> gst_element_seek_simple(data->sink,GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
> 56500000000);
>
> I put a buffer probe on on the demux src probe, this is the output :
> Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56433000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615
> Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56367000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615
> Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56333000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615
> Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56400000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615
> *Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56500000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615*
> Buffer 0 GST_BUFFER_FLAG_DELTA_UNIT Duration 33333333PTS : 56467000000
> Target : 56500000000 DTS : -1 Offset : 18446744073709551615
> Receive EOS on the probe
>
> With my understanding, the demux element find the frame but this frame isn't
> correctly recognized or forwarded to the downstream. Am I right ?
You mean because it starts outputting buffers before the seek position?
That happens because it has to start at the last keyframe before the
seek position. A decoder will (should) drop all buffers before the seek
position after decoding.
Or you mean it's wrong because the last buffer to be displayed is the
second to last buffer, and another one with a smaller PTS is output
afterwards and only then EOS? That happens because you're using a codec
that uses frame reordering. The decoder needs the frames in this order
for proper decoding, and the last to be displayed frame has to be
decoded before another frame that would be displayed before that. The
decoder will reorder the frames to display order.
--
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140125/a932e514/attachment.pgp>
More information about the gstreamer-devel
mailing list