After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682172 - qtdemux: avoid reading parts of file not used (skip reading video data if only audio is active)
qtdemux: avoid reading parts of file not used (skip reading video data if onl...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-18 20:29 UTC by David Jordan
Modified: 2018-11-03 14:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Jordan 2012-08-18 20:29:15 UTC
Currently Gstreamer will read all of a file from disk even if certain streams are not needed and could be skipped.  This can be an issue when, for example, one wants to process only the audio stream from a file containing both audio and high-bitrate video, since performance will be bottlenecked by hard disk throughput.
If elements like qtdemux could determine which streams aren't being used, avoid reading data for unused streams, and instead only read the index and the streams which are being used; this would hugely increase performance in those use cases.

A good test uses footage from a Canon DSLR, which is commonly used for professional video.  One 12 minute file is 4GB in size, of which less than 150MB is audio.  
The following pipeline takes approximately as long as simply reading the entire file from disk. (about 40 seconds *uncached* on a Sandybridge laptop using the file below)
time gst-launch-1.0 filesrc location="$INPUT_FILE" ! qtdemux ! audioconvert ! filesink location="OUTPUT_FILE"
When I profiled it, most time was spent in functions for reading from disk (kernel -> system_call_fastpath -> sys_read), with CPU usage remaining low.

After extracting the audio only and placing it in another qt container, the time required was dramatically reduced.

Example DLSR file can be found here (about 4GB).
http://uds-o.novacut.com/GWQ5M6GPPNVEY3SAGUORKMLUAMQGD6O4.mov

We should figure out a way to signal this behavior properly for elements like qtdemux.
Comment 1 Edward Hervey 2013-07-17 06:39:09 UTC
An alternative solution for this would be to have mmap-ed GstMemory. If the memory is not used => not hit on harddrive.
Comment 2 Sebastian Dröge (slomo) 2013-07-17 08:33:07 UTC
Related to that is this bug btw https://bugzilla.gnome.org/show_bug.cgi?id=691299  (although slightly different)
Comment 3 Tim-Philipp Müller 2013-07-17 08:42:09 UTC
No, that's not what this is about or how it should be done. Too specific, and the benefit is especially large when doing things over the network.

This bug depends primarily on the stream activation API IMHO, so the demuxer can skip reading chunks for tracks that aren't active.
Comment 4 Edward Hervey 2018-05-10 11:47:44 UTC
The problem is also having a system by which the demuxer can "reliably" know that some streams are not needed by downstream.

The GST_EVENT_SELECT_STREAM *partially* solves this issue, but isn't enough to know that unselected streams will *never* be needed.
Comment 5 GStreamer system administrator 2018-11-03 14:47:27 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/71.