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/examples/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? 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? Thanks in advance, -Kirk Kirk A. Baker Senior Software Engineer Camera Bits, Inc. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (817 bytes) Download Attachment |
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? 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? > > Thanks in advance, > > -Kirk > > Kirk A. Baker > Senior Software Engineer > Camera Bits, Inc. > > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (201 bytes) Download Attachment |
Free forum by Nabble | Edit this page |