Re: [FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

2019-09-21 Thread Carl Eugen Hoyos
Am Sa., 21. Sept. 2019 um 20:16 Uhr schrieb Rodger Combs
:
>
> Fixes some files misdetecting as MPEG PS

The reason for the misdetection (mp3 file with 50k header that contains a
mjpeg cover) are the following "lame tags" (I couldn't immediately find out
what they really are) which nearly all contain "02 ae" which is identified as
VIDEO_ID by the mpegps probe function. The video variable is 9 after 64k
of the function, all other relevant variables are 0):

e880  00 00 00 00 00 00 00 00  00 00 00 00 00 ff fb e2  ||
e890  44 00 0f f0 78 00 ab 83  e0 00 00 0e 80 16 c0 7c  |D...x..||
e8a0  00 00 01 e0 02 ae 0f 80  00 00 3a 00 5b 01 f0 00  |..:.[...|
e8b0  00 2b f4 b7 ff ff ff ff  ff d3 ff ff ff ff ff e9  |.+..|
e8c0  2b e8 3b ff ff ff ff ff  ff ff ff ff ff fe 82 bf  |+.;.|
e8d0  4b 7f ff ff ff ff fd 3f  ff ff ff ff fe 92 be 83  |K..?|
e8e0  bf ff ff ff ff ff ff ff  ff ff ff e8 4c 41 4d 45  |LAME|
e8f0  33 2e 39 38 2e 32 00 00  00 00 00 00 00 00 00 00  |3.98.2..|
e900  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
*
eca0  00 00 ff fb e2 44 00 0f  f0 78 00 ab 83 e0 00 00  |.D...x..|
ecb0  0e 80 16 c0 7c 00 00 01  e0 02 ae 0f 80 00 00 3a  ||..:|
ecc0  00 5b 01 f0 00 00 2b f4  b7 ff ff ff ff ff d3 ff  |.[+.|
ecd0  ff ff ff ff e9 2b e8 3b  ff ff ff ff ff ff ff ff  |.+.;|
ece0  ff ff fe 82 bf 4b 7f ff  ff ff ff fd 3f ff ff ff  |.K..?...|
ecf0  ff fe 92 be 83 bf ff ff  ff ff ff ff ff ff ff ff  ||
ed00  e8 4c 41 4d 45 33 2e 39  38 2e 32 00 00 00 00 00  |.LAME3.98.2.|
ed10  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
*
f0b0  00 00 00 00 00 00 00 ff  fb e2 44 00 0f f0 78 00  |..D...x.|
f0c0  ab 83 e0 00 00 0e 80 16  c0 7c 00 00 01 e0 02 ae  |.|..|
f0d0  0f 80 00 00 3a 00 5b 01  f0 00 00 2b f4 b7 ff ff  |:.[+|
f0e0  ff ff ff d3 ff ff ff ff  ff e9 2b e8 3b ff ff ff  |..+.;...|
f0f0  ff ff ff ff ff ff ff fe  82 bf 4b 7f ff ff ff ff  |..K.|
f100  fd 3f ff ff ff ff fe 92  be 83 bf ff ff ff ff ff  |.?..|
f110  ff ff ff ff ff e8 4c 41  4d 45 33 2e 39 38 2e 32  |..LAME3.98.2|
f120  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
*
f4c0  00 00 00 00 00 00 00 00  00 00 00 00 ff fb e2 44  |...D|
f4d0  00 0f f0 78 00 ab 83 e0  00 00 0e 80 16 c0 7c 00  |...x..|.|
f4e0  00 01 e0 02 ae 0f 80 00  00 3a 00 5b 01 f0 00 00  |.:.[|
f4f0  2b f4 b7 ff ff ff ff ff  d3 ff ff ff ff ff e9 2b  |+..+|
f500  e8 3b ff ff ff ff ff ff  ff ff ff ff fe 82 bf 4b  |.;.K|
f510  7f ff ff ff ff fd 3f ff  ff ff ff fe 92 be 83 bf  |..?.|
f520  ff ff ff ff ff ff ff ff  ff ff e8 4c 41 4d 45 33  |...LAME3|
f530  2e 39 38 2e 32 00 00 00  00 00 00 00 00 00 00 00  |.98.2...|
f540  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
*
f8e0  00 ff fb e2 44 00 0f f0  78 00 ab 83 e0 00 00 0e  |D...x...|
f8f0  80 16 c0 7c 00 00 01 e0  02 ae 0f 80 00 00 3a 00  |...|..:.|
f900  5b 01 f0 00 00 2b f4 b7  ff ff ff ff ff d3 ff ff  |[+..|
f910  ff ff ff e9 2b e8 3b ff  ff ff ff ff ff ff ff ff  |+.;.|
f920  ff fe 82 bf 4b 7f ff ff  ff ff fd 3f ff ff ff ff  |K..?|
f930  fe 92 be 83 bf ff ff ff  ff ff ff ff ff ff ff e8  ||
f940  4c 41 4d 45 33 2e 39 38  2e 32 00 00 00 00 00 00  |LAME3.98.2..|
f950  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||
*
fcf0  00 00 00 00 00 00 ff fb  e2 44 00 0f f0 78 00 ab  |.D...x..|
fd00  83 e0 00 00 0e 80 16 c0  7c 00 00 01 e0 02 ae 0f  ||...|
fd10  80 00 00 3a 00 5b 01 f0  00 00 2b f4 b7 ff ff ff  |...:.[+.|
fd20  ff ff d3 ff ff ff ff ff  e9 2b e8 3b ff ff ff ff  |.+.;|
fd30  ff ff ff ff ff ff fe 82  bf 4b 7f ff ff ff ff fd  |.K..|
fd40  3f ff ff ff ff fe 92 be  83 bf ff ff ff ff ff ff  |?...|
fd50  ff ff ff ff e8 4c 41 4d  45 33 2e 39 38 2e 32 00  |.LAME3.98.2.|
fd60  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ||

I would expect that it is possible to detect that the above are not valid
mpeg video packets.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

2019-09-21 Thread Rodger Combs
Fixes some files misdetecting as MPEG PS
---
 libavformat/mp3dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 258f19174b..d9aaee50b9 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -100,13 +100,13 @@ static int mp3_read_probe(const AVProbeData *p)
 max_framesizes = FFMAX(max_framesizes, framesizes);
 if(buf == buf0) {
 first_frames= frames;
-if (buf2 == end + sizeof(uint32_t))
+if (buf2 >= end + sizeof(uint32_t))
 whole_used = 1;
 }
 }
 // keep this in sync with ac3 probe, both need to avoid
 // issues with MPEG-files!
-if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
+if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1 + whole_used * 
FFMIN(first_frames / 2, 5);
 else if(max_frames>200 && p->buf_size < 2*max_framesizes)return 
AVPROBE_SCORE_EXTENSION;
 else if(max_frames>=4 && p->buf_size < 2*max_framesizes) return 
AVPROBE_SCORE_EXTENSION / 2;
 else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 
2*ff_id3v2_tag_len(buf0) >= p->buf_size)
-- 
2.21.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

2019-03-16 Thread Michael Niedermayer
On Sat, Mar 16, 2019 at 05:24:46AM -0500, Rodger Combs wrote:
> Fixes some files misdetecting as MPEG PS
> ---
>  libavformat/mp3dec.c | 4 ++--

If MPEG PS misdetects a file, i would first try to fix the mpeg ps
probe to not misdetect it and produce a lower score for whatever
makes this file not mpeg-ps.

But i have not seen the file so this is just the general direction
i would look into ...

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

2019-03-16 Thread Carl Eugen Hoyos
Am Sa., 16. März 2019 um 11:25 Uhr schrieb Rodger Combs
:
>
> Fixes some files misdetecting as MPEG PS

Please provide such a sample.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] lavf/mp3dec: increase probe score of buffers entirely composed of valid packets

2019-03-16 Thread Rodger Combs
Fixes some files misdetecting as MPEG PS
---
 libavformat/mp3dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index ef884934e1..81da0c6090 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -100,13 +100,13 @@ static int mp3_read_probe(AVProbeData *p)
 max_framesizes = FFMAX(max_framesizes, framesizes);
 if(buf == buf0) {
 first_frames= frames;
-if (buf2 == end + sizeof(uint32_t))
+if (buf2 >= end + sizeof(uint32_t))
 whole_used = 1;
 }
 }
 // keep this in sync with ac3 probe, both need to avoid
 // issues with MPEG-files!
-if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
+if   (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1 + whole_used * 
FFMIN(first_frames / 2, 5);
 else if(max_frames>200 && p->buf_size < 2*max_framesizes)return 
AVPROBE_SCORE_EXTENSION;
 else if(max_frames>=4 && p->buf_size < 2*max_framesizes) return 
AVPROBE_SCORE_EXTENSION / 2;
 else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 
2*ff_id3v2_tag_len(buf0) >= p->buf_size)
-- 
2.20.1

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel