Skip to content

Draft: mxf: mpeg2 detect open gops in index-less streams

François Laignel requested to merge fengalin/gstreamer:mxf-mpeg2-seek into main

This MR adds open gop detection to mxfdemux when handling an index-less stream.

mxfdemux is capable of building an index on the fly when it is not included in the original stream. However, it made no distinction whether key frames were part of an open or closed gop. When a seek occurred, the first preceding key frame was selected even if it was part of an open gop, which could lead to decoded frames being dropped due to missing reference frame(s). In case of a seek in paused state, preroll would fail.

Fixes #2587

While working on this MR, seek handling was found to be dysfunctional for some mpeg2 decoders.

Expected behaviour achieved using:

  • avdec_mpeg2video (unchanged).
  • vaapimpeg2dec (fix included).
  • mpeg2dec (fix included).
  • vampeg2dec (fix included).

TODO:

  • Figure out a proper way to pass the open_gop status from mxf_mpeg_is_mpeg2_keyframe.
  • Fix other decoders?
  • Add unit tests.
  • Fix an issue with an mxfmux generated file: seeking to the penultimate position can yield the last one instead using mxfdemux. Problem not showing with a file muxed using ffmpeg.
  • Fix an issue with mpegvideoparse: pts can be shifted / duplicated (due to B-frames?).
Edited by François Laignel

Merge request reports