[Bug 790696] New: Seek in matroska file (H.264) ends up in cluster with no key-frame.
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Wed Nov 22 07:45:00 UTC 2017
https://bugzilla.gnome.org/show_bug.cgi?id=790696
Bug ID: 790696
Summary: Seek in matroska file (H.264) ends up in cluster with
no key-frame.
Classification: Platform
Product: GStreamer
Version: 1.13.x
OS: Linux
Status: NEW
Severity: normal
Priority: Normal
Component: gst-plugins-good
Assignee: gstreamer-bugs at lists.freedesktop.org
Reporter: mats.lindestam at axis.com
QA Contact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
Created attachment 364170
--> https://bugzilla.gnome.org/attachment.cgi?id=364170&action=edit
Test-application and example matroska-file.
Hi,
We have found an issue when seeking in a h264-matroske file that has very long
GOP-length and no cluster index.
The extra long GOP-lengt causes the matroska file to contain clusters that
doesn't have a key-frame. The reason to there being no index is due to that the
seek is done in an ongoing recording where the file, not yet has been completed
and written to disc.
When seeking in the matroska file you sometimes end up on a cluster that
doesn't
have a key-frame and this causes the matroska file to not being able to be
correctly decoded.
I have tried to make a small application (seek_app.c) that shows the issue, and
yes it is a total rip off of your basic tutorial 6.
I have attached a matroska file (h264_two_keyframes_cues_removed.mkv) that has
two clusters including key-frames. From mkvinfo tool:
Cluster at 456
Cluster timecode: 0.000s at 468
SimpleBlock (key, track number 1, 1 frame(s), timecode 0.000 =
00:00:00.000) at 471
Cluster at 81574
Cluster timecode: 114.932s at 81586
SimpleBlock (key, track number 1, 1 frame(s), timecode 114.932 =
00:01:54.932) at 81595
There is no index in the file, to simulate an ongoing recording.
The test-application works something like this:
The seek is started after 10 seconds
#define TIME_SEEK_START 10
I have tested doing three different seeks at 40, 130 and 160 seconds:
#define TIME_SEEK_POS 40
#define TIME_SEEK_POS 130
#define TIME_SEEK_POS 160
If a seek is done to TIME_SEEK_POS 40 the seek will find a cluster at offset
72483 with time 0:00:33.466000000. The cluster at offset 72483 does not contain
any key-frame. The seek continues at 0:00:33.466000000 and the video can not be
decoded. The seek should have found cluster at offset 456 with time
0:00:00.000000000 that contains a key-frame.
matroska-demux.c:2137:gst_matroska_demux_search_pos:<matroskademux0> found
cluster at offset 72483 with time 0:00:33.466000000
matroska-demux.c:2216:gst_matroska_demux_search_pos:<matroskademux0>
simulated index entry; time 0:00:33.466000000, pos 72439
If a seek is done to TIME_SEEK_POS 130 the seek will find a cluster at offset
81574 with time 0:01:54.932000000. The cluster at offset 81574 contains a
key-frame. The seek continues at 0:01:54.932000000 and the video can be
decoded.
matroska-demux.c:2137:gst_matroska_demux_search_pos:<matroskademux0> found
cluster at offset 81574 with time 0:01:54.932000000
matroska-demux.c:2216:gst_matroska_demux_search_pos:<matroskademux0>
simulated index entry; time 0:01:54.932000000, pos 81530
matroska-demux.c:2415:gst_matroska_demux_handle_seek_event:<matroskademux0>
seek to key unit, adjusting segment start from 0:02:10.000000000 to
0:01:54.932000000
If a seek is done to TIME_SEEK_POS 160 the seek will find a cluster at offset
133909 with time 0:02:27.932000000. The cluster at offset 133909 does not
contain any key-frame. The seek continues at 0:02:27.932000000 and the video
can
not be decoded. The seek should have found cluster at offset 81574 with time
0:01:54.932000000 that contains a key-frame.
matroska-demux.c:2137:gst_matroska_demux_search_pos:<matroskademux0> found
cluster at offset 133909 with time 0:02:27.932000000
matroska-demux.c:2216:gst_matroska_demux_search_pos:<matroskademux0>
simulated index entry; time 0:02:27.932000000, pos 133865
matroska-demux.c:2415:gst_matroska_demux_handle_seek_event:<matroskademux0>
seek to key unit, adjusting segment start from 0:02:40.000000000 to
0:02:27.932000000
We have a local patch that works on our code, but it does not work on the
latest Gstreamer code (1.13.x), for gst-plugins-good (matroska-demux.c).
We are working on making the patch work but we are not there yet, so any good
input, on making a patch, is greatly appreciated.
Regards
/Mats
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list