Video seeking. Best practices

Ilya Aleshkov ilya.aleshkov at
Fri Feb 14 18:09:31 UTC 2020


I'd like to make my seeking process as interactive as possible.
In general everything works. I'm able to preview and record streams from
webcams from my C++ code.
Recording pipeline equivalent looks like:

gst-launch-1.0 -e v4l2src device=/dev/video0 ! "video/x-raw, ..." !
videoconvert ! x264enc ! matroskamux ! filesink location=filename.mkv

or (using NVIDIA's hardware-accelerated NVENC encoder API)

gst-launch-1.0 -e v4l2src device=/dev/video0 ! "video/x-raw, ..." !
videoconvert ! nvh264enc ! h264parse ! matroskamux ! filesink

It's not hard to playback my recordings with playbin and seek:

gst_element_get_state(m_pipeline, nullptr, nullptr, GST_CLOCK_TIME_NONE);
// This trick make seeking much more interactive
gst_element_seek(m_pipeline, 1.0, GST_FORMAT_TIME,
                  (GstSeekFlags) (GST_SEEK_FLAG_FLUSH |
                  GST_SEEK_TYPE_SET, position, GST_SEEK_TYPE_NONE,

But even using NVDEC I'm not happy with performance. It's not bad at all,
but not smartphone-like smooth. What can I do to dramatically improve it?

Environment: Ubuntu 19.10 / Intel Core i7-2600 / GeForce GTX 1050 Ti / SSD

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list