[FFmpeg-devel] [FFmpeg-cvslog] lavf/amr: Make the heuristic for auto-detection even stricter.

Carl Eugen Hoyos ceffmpeg at gmail.com
Tue Jun 26 00:22:31 EEST 2018


2018-06-23 14:43 GMT+02:00, Michael Niedermayer <michael at niedermayer.cc>:
> On Thu, Jun 21, 2018 at 10:09:14PM +0000, Carl Eugen Hoyos wrote:
>> ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Fri Jun
>> 22 00:08:13 2018 +0200| [40b7e6071815fc416a4efc5dc1616f5460a3aacb] |
>> committer: Carl Eugen Hoyos
>>
>> lavf/amr: Make the heuristic for auto-detection even stricter.
>>
>> Fixes ticket #7270.
>>
>> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40b7e6071815fc416a4efc5dc1616f5460a3aacb
>> ---
>>
>>  libavformat/amr.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libavformat/amr.c b/libavformat/amr.c
>> index f954803d46..6cc06bceac 100644
>> --- a/libavformat/amr.c
>> +++ b/libavformat/amr.c
>> @@ -201,7 +201,7 @@ static int amrnb_probe(AVProbeData *p)
>>              i++;
>>          }
>>      }
>> -    if (valid > 100 && valid > invalid)
>> +    if (valid > 100 && valid >> 4 > invalid)
>>          return AVPROBE_SCORE_EXTENSION / 2 + 1;
>>      return 0;
>>  }
>> @@ -258,8 +258,8 @@ static int amrwb_probe(AVProbeData *p)
>>              i++;
>>          }
>>      }
>> -    if (valid > 100 && valid > invalid)
>> -        return AVPROBE_SCORE_EXTENSION / 2 - 1;
>> +    if (valid > 100 && valid >> 4 > invalid)
>> +        return AVPROBE_SCORE_EXTENSION / 2 + 1;
>
> This breaks detecting the h263 file:
>
> https://samples.ffmpeg.org/V-codecs/h263/h263-raw/messenger.h263

Attached patch fixes the existing heuristic to avoid detection of files
like this one.

Sorry, Carl Eugen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavf-amr-Fix-heuristic-to-avoid-detection-of-repeate.patch
Type: text/x-patch
Size: 1421 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180625/b026ce6e/attachment.bin>


More information about the ffmpeg-devel mailing list