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

Michael Niedermayer michael at niedermayer.cc
Sun Jun 9 00:00:25 EEST 2019


On Sat, Jun 08, 2019 at 03:21:45PM +0200, Antonin Gouzer 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"

This information does not end in the commit message, the result is a
commit message thats a bit too terse, information wise.


> Ex: https://drive.google.com/file/d/1cNtLwnfPnyJnYqE7OYhU3SCoLRtuXIUM/view?usp=sharing

do you want to submit a fate test ?


> 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)
>  {

you could split this change in a seperate patch, this would make git log
slightly more readable 


>      int master_ret = 0;
>  
> @@ -425,27 +425,33 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
>          } while (get_bits(gb, 8) == 255);
>  
>          if (size > get_bits_left(gb) / 8) {
> -            av_log(logctx, AV_LOG_ERROR, "SEI type %d size %d truncated at %d\n",
> +            
> +            if (size == get_bits_left(gb) / 8 + 1 && avctx->strict_std_compliance <= FF_COMPLIANCE_NORMAL){
> +                av_log(avctx, AV_LOG_WARNING, "SEI type %d size %d truncated at %d\n",
>                     type, 8*size, get_bits_left(gb));
> +               } else {
> +                av_log(avctx, AV_LOG_ERROR, "SEI type %d size %d truncated at %d, data will not be read\n",
> +                   type, 8*size, get_bits_left(gb));
> +                return AVERROR_INVALIDDATA;
> +               }

something is not right with the indention here

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190608/21bd9afe/attachment.sig>


More information about the ffmpeg-devel mailing list