AppSink pull-preroll doesn't work on H.264 MP4 Videos

Nicolas Dufresne nicolas at ndufresne.ca
Fri Aug 4 18:27:44 UTC 2017


Le vendredi 04 août 2017 à 10:01 -0700, Kirk Baker a écrit :
> Hello,
> 
> I have been working on a small program to extract frames from videos,
> basing my work on the 'snapshot' example code:
> 
> <https://cgit.freedesktop.org/gstreamer/gst-plugins-base/tree/tests/e
> xamples/snapshot/snapshot.c>
> 
> …adapting it to our needs.  It works great for the great majority of
> video formats that I've tried, but H.264 encoded MP4 videos cause it
> to hang when emitting the 'pull-preroll' signal.  I modified the code
> to instead call gst_app_sink_try_pull_preroll() and giving it a 15-
> second timeout, which eliminates the hang but does not produce a
> frame sample either.
> 
> Is this expected?  Is there some way to work around this behavior?

H.264 and snapshops (aka single image) isn't a great fit. Encoder may
require multiple input frame before producing the first output. To
workaround this, you should send en EOS event to force the encoder from
draining the frames.

> 
> In order to try and diagnose the problem I have played around with
> gst-launch-1.0 like so:
> 
> gst-launch-1.0 filesrc location=path/to/mp4 ! decodebin ! queue !
> autovideoconvert ! pngenc ! filesink location="frame.png"
> 
> And it does produce an image correctly (it writes each frame of the
> video to the same image file though, and I do know that one can
> number the files if one wants to.)  But I only want one frame at a
> particular time point in the video, so this isn't a good solution for
> us.
> 
> Any ideas?

EOS event.

> 
> Thanks in advance,
> 
> -Kirk
> 
> Kirk A. Baker
> Senior Software Engineer
> Camera Bits, Inc.
> 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170804/ff2571cb/attachment.sig>


More information about the gstreamer-devel mailing list