Opened 3 years ago

Last modified 6 weeks ago

#7799 open defect

hevc_mp4toannexb filter inserts extradata wrong position

Reported by: Hyemin Lee Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: hevc
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

After applied hevc_mp4toannexb filter to the attached video (refer to the below link),
the frames become broken from the video players (e.g. VLC, ffplay)

The problem is caused by prepending the extra-data to IRAP frames in libavcodec/hevc_mp4toannexb_bsf.c.

This video contains own vps/sps/pps for every IRAP frames.
The extradata from hevcc is slightly different from every IRAP frames have (in this case QP value is different) and the hevc_mp4toannexb filter prepends the different extradata to every IRAP frames, causing the broken frames.

Video File Repo :
https://www.dropbox.com/s/tpyohk6vf096zxm/hevc_after_mp4toannexb_conversion_qp_value_modified.mp4?dl=0

I am afraid that I can't connect to ftp://upload.ffmpeg.org, so I just attached to the dropbox url
How to reproduce:

% ffmpeg -i hevc_after_mp4toannexb_conversion_qp_value_modified.mp4 -codec copy -bsf:v hevc_mp4toannexb output.hevc
$vlc output.hevc

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

hevc_after_mp4toannexb_conversion_qp_value_modified.mp4 (719.7 KB ) - added by Carl Eugen Hoyos 3 years ago.

Download all attachments as: .zip

Change History (15)

comment:1 by Carl Eugen Hoyos, 3 years ago

How did you create the input file?

in reply to:  1 ; comment:3 by Hyemin Lee, 3 years ago

Replying to cehoyos:

How did you create the input file?

Unfortunately, I did not create the video. It is automatically transcoded via a messenger application. (I do not exactly know how they transcode)

I know how to avoid this issue, (just not prepend the extra-data, if the extra-data has already existed on IRAP frames)

However, I do not exactly know whether this solution is correct or not.

in reply to:  1 comment:2 by Hyemin Lee, 3 years ago

Last edited 3 years ago by Hyemin Lee (previous) (diff)

in reply to:  3 ; comment:3 by Carl Eugen Hoyos, 3 years ago

Replying to gudbooy:

Replying to cehoyos:

How did you create the input file?

Unfortunately, I did not create the video. It is automatically transcoded via a messenger application. (I do not exactly know how they transcode)

Which one? The file indicates that it was created with FFmpeg.

comment:4 by Hyemin Lee, 3 years ago

The file I uploaded (hevc_after_mp4toannexb_conversion_qp_value_modified.mp4​).

comment:5 by Carl Eugen Hoyos, 3 years ago

Which messenger application?

comment:6 by Hyemin Lee, 3 years ago

The messenger application called KAKAO-TALK, which is the famous app in Korea
The original one is H.264 encoded Video transcoded by Xiomi video editing application.

comment:7 by Carl Eugen Hoyos, 3 years ago

Keywords: hevc added
Version: unspecifiedgit-master

comment:8 by Andriy Gelman, 2 years ago

hevc_mp4toannexb bsf doesn't insert correct parameter sets if they change in-band. For now, you can just use hevc_metadata filter to do the same job:

./ffmpeg -i hevc_after_mp4toannexb_conversion_qp_value_modified.mp4 -bsf:v hevc_metadata -codec:v copy output.hevc

in reply to:  8 comment:9 by Hyemin Lee, 23 months ago

Replying to taliho:

hevc_mp4toannexb bsf doesn't insert correct parameter sets if they change in-band. For now, you can just use hevc_metadata filter to do the same job:

./ffmpeg -i hevc_after_mp4toannexb_conversion_qp_value_modified.mp4 -bsf:v hevc_metadata -codec:v copy output.hevc

Thanks, I will try it and let you know

comment:10 by Balling, 15 months ago

Status: newopen

https://patchwork.ffmpeg.org/project/ffmpeg/patch/20191016025040.31273-2-andriy.gelman@gmail.com/

Apply that already.

Issue showed itself here:
https://github.com/rigaya/NVEnc/issues/237

Actually with warning!

[hevc_mp4toannexb @ 000001cea55b2f00] No parameter sets in the extradata
So maybe other issue??

Last edited 15 months ago by Balling (previous) (diff)

comment:11 by Balling, 13 months ago

Guys, when this will be fixed? We have a patch.

comment:13 by Balling, 6 weeks ago

Sorry, it does NOT just look related, it is the "same" patch since FATE had the same change!! PLEASE APPLY!!!

-fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9
+fate-hevc-bsf-mp4toannexb: REF = 3c9d998a3aa2b9e0fb1c1f434952bf8b

Note: See TracTickets for help on using tickets.