[FFmpeg-devel] [PATCH 0/2] Interpret a degenerate SAR as 1/1.
Giovanni Mascellani
gmascellani at codeweavers.com
Wed Jul 31 12:43:45 EEST 2024
Hi,
Il 30/07/24 22:54, michael at niedermayer.cc (Michael Niedermayer) ha
scritto:
> Why does playback fail ? > 1/1 and unspecified are different things, 0/0 would be unspecified
> where does 20480/0 turn into 20480/1 ? or did i misunderstand this?
It seems that denominator 0 is replaced with 1 here:
https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/262168b04e6807fce6a78507c14cfc166ba72845:/libavcodec/h264_ps.c#l552
Considering the other replies I would guess that the intent is to
prevent a division by zero from happening, but the side effect is that
an invalid SAR is silently converted to a valid one (even if quite extreme).
I am not sure why that in turn causes the playback problems. I noticed
that the same problem can be reproduced on any other H.264 file simply
by forcing the broken 20480/0 SAR in ff_h2645_decode_common_vui_params().
After a few more experiments, it seems that ffmpeg is indeed able to
handle an unspecified SAR, but it doesn't like it to be represented as
x/0, only 0/x. I'll send a revised patch which replaces x/0 with 1/0,
hopefully addressing your concern.
Thanks, Giovanni.
More information about the ffmpeg-devel
mailing list