GNOME Bugzilla – Bug 797155
Snapshot doesn't produce a good image for mpeg-ts video
Last modified: 2018-09-18 23:19:58 UTC
When using the snapshot application: https://github.com/GStreamer/gst-plugins-base/blob/master/tests/examples/snapshot/snapshot.c The only modification to the code I made is to put 50/100 (50% instead of 5%). gcc snapshot.c `pkg-config --cflags --libs gstreamer-1.0 gtk+-3.0` it's working well with a mp4 file but it generates a gray image for a mpeg-ts file. See two examples here: http://gentil.com/tmp/snapshot.zip I think that the reason is that the mpeg-ts has less information about timestamp so it needs a few frames before it decodes properly a key frame. How can the source code be patched so that multiple successive frames are decoded before the sample is taken? Note that if I play the mpeg-ts file and I seek, the first 0.2s is also gray for the same reason explained above.
I eventually used gst_element_send_event(pipeline, gst_event_new_step(GST_FORMAT_BUFFERS, 1, 1.0f, TRUE, FALSE)); to move forward and get a good frame.