[FFmpeg-devel] [PATCH] libavformat/qsvenc: repeat mpeg2 missing headers [v2]
andreas.hakon at protonmail.com
Tue Jun 4 12:38:57 EEST 2019
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Thursday, 30 de May de 2019 20:48, Reimar Döffinger <Reimar.Doeffinger at gmx.de> wrote:
> On 28.05.2019, at 12:48, Andreas Håkonandreas.hakon at protonmail.com wrote:
> > Hi,
> > This patch supersedes #13105 (https://patchwork.ffmpeg.org/patch/13105/)
> > A new (simpler and more robust) implementationof of the reinsertion of the
> > missing headers in the MPEG-2 bitstream from the HW QSV encoder.
> > The problem is quite simple: The bitstream generated by the MPEG-2 QSV
> > encoder only incorporates the SEQ_START_CODE and EXT_START_CODE
> > headers in the first GOP. This generates a result that is not suitable for
> > streaming or broadcasting.
> > With this patch the "mpeg2_qsv" encoder is at the same level as the
> > "mpeg2video", as the software implementation repeats these headers by default
> > in each GOP.
> I am sure I might be missing things, but I would think that this is only necessary
> when muxing into certain containers.
> I.e. I would think when muxing the stream into .mov, .mkv or .nut files your patch
> would only needlessly bloat the size.
Yes and no.
First of all, please let me know which MPEG-2 encoders do not repeat these headers
when using MPEG-TS. For streaming repetion is absolutely required. And I feel that's
the reason why the native mpeg2 encoder does it.
> I admit this also applies to the native mpeg2 encoder, so this might be a design issue
> in FFmpeg, but it's the background why it feels a bit wrong to do it in the encoder...
Take note that the "dump_extra" filter with the parameter "remove" can be used to remove
the repetition. But contrary to popular belief (IMHO), there is no way to repeat these
headers using a bitstream filter. So for this reason this patch is necessary.
In any case, if you suggest that this behaviour should be optional, then I can add a
parameter to enable it and leave it disabled by default.
More information about the ffmpeg-devel