[FFmpeg-devel] [PATCH v4 1/4] hevc_mp4toannexb: Insert correct parameter sets before IRAP

Andriy Gelman andriy.gelman at gmail.com
Fri Sep 20 17:28:35 EEST 2019


On Thu, 19. Sep 02:16, Fu, Linjie wrote:
> > -----Original Message-----
> > From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> > Of Andriy Gelman
> > Sent: Thursday, September 19, 2019 03:32
> > To: ffmpeg-devel at ffmpeg.org
> > Cc: Andriy Gelman <andriy.gelman at gmail.com>
> > Subject: [FFmpeg-devel] [PATCH v4 1/4] hevc_mp4toannexb: Insert correct
> > parameter sets before IRAP
> > 
> > From: Andriy Gelman <andriy.gelman at gmail.com>
> > 
> > Fixes #7799
> > 
> > Currently, the mp4toannexb filter always inserts the same extradata at
> > the start of the first IRAP unit. As in ticket #7799, this can lead to
> > decoding errors if modified parameter sets are signalled in-band.
> > 
> > This commit keeps track of the VPS/SPS/PPS parameter sets during the
> > conversion. The correct combination is inserted at the start of the
> > first IRAP. SEIs from extradata are inserted before each IRAP.
> > 
> > This commit also makes an update to the hevc-bsf-mp4toannexb fate test
> > since the result before this patch contained duplicate parameter sets
> > in-band.
> > ---
> >  libavcodec/hevc_mp4toannexb_bsf.c | 490
> > +++++++++++++++++++++++++++---
> >  tests/fate/hevc.mak               |   2 +-
> >  2 files changed, 457 insertions(+), 35 deletions(-)
> > 
> > --- a/tests/fate/hevc.mak
> > +++ b/tests/fate/hevc.mak
> > @@ -238,7 +238,7 @@ FATE_HEVC-$(call ALLYES, HEVC_DEMUXER
> > MOV_DEMUXER HEVC_MP4TOANNEXB_BSF MOV_MUXER
> >  fate-hevc-bsf-mp4toannexb: tests/data/hevc-mp4.mov
> >  fate-hevc-bsf-mp4toannexb: CMD = md5 -i
> > $(TARGET_PATH)/tests/data/hevc-mp4.mov -c:v copy -fflags +bitexact -f
> > hevc
> >  fate-hevc-bsf-mp4toannexb: CMP = oneline
> > -fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9
> > +fate-hevc-bsf-mp4toannexb: REF = 3c9d998a3aa2b9e0fb1c1f434952bf8b
> 
> I kind of remember some discussions about 3 or 4 bit start code for hevc:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2018-November/236899.html
> 
> Since this patch intends to modify the md5 in fate, maybe it's a good time to
> have this fixed as well.

I looked at your patch and the changes seem reasonable to me (although I
couldn't apply it to master).

Btw, I came across something similar when segmenting an annexb packet using the
ff_h2645_packet_split function. The split nal units had a trailing 0x00 byte
from the start code prefix of the next nal unit.

-- 
Andriy


More information about the ffmpeg-devel mailing list