[FFmpeg-devel] [PATCH v2] avcodec/h264_sei: Add acces to truncated SEI data

Vittorio Giovara vittorio.giovara at gmail.com
Mon Jun 10 07:52:06 EEST 2019


On Sat, Jun 8, 2019 at 9:28 AM Antonin Gouzer <antonin.gouzer at gmail.com>
wrote:

> ---
> Some codecs editors had miss interpreted the H264 standart and
> have coded a wrong size in the SEI data.
> size = SEI size + 1.
> The SEI data is detected as "truncated"
> Ex:
> https://drive.google.com/file/d/1cNtLwnfPnyJnYqE7OYhU3SCoLRtuXIUM/view?usp=sharing
> Command:
> ffprobe -print_format xml -show_frames -read_intervals %+0.04
> truncated.h264
> This (simple) patch add the possibility to read this false truncated SEI
> data with the default stric_std_compliance or less.
> The error remain logged in both cases.
>
> V2: Modifiy the patch for only the off by one values
>
> Thanks in advance !
> ---
>  libavcodec/h264_sei.c | 24 +++++++++++++++---------
>  libavcodec/h264_sei.h |  2 +-
>  2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> index d4eb9c0dab..7871cf87ed 100644
> --- a/libavcodec/h264_sei.c
> +++ b/libavcodec/h264_sei.c
> @@ -402,7 +402,7 @@ static int
> decode_alternative_transfer(H264SEIAlternativeTransfer *h,
>  }
>
>  int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
> -                       const H264ParamSets *ps, void *logctx)
> +                       const H264ParamSets *ps, AVCodecContext *avctx)
>  {
>      int master_ret = 0;
>
>
This may be a minor note, but i don't think it's worth to check for std
compliance within a *parsing* function: in my opinion it would make more
sense to check in the calling function, and always allow for truncated sei,
and error out only if (avctx->error | AV_ERROR_EXPLODE) is set (sorry going
by memory here)
-- 
Vittorio


More information about the ffmpeg-devel mailing list