On Mon, Aug 19, 2019 at 7:22 PM Carl Eugen Hoyos <ceffm...@gmail.com> wrote:

>
> This score would mean that mjpeg can never be detected.
> I suspect you have to reduce one of the demuxers to "- 1".
>
>
Thanks Carl.
Attached patch to reduce mpeg probe by -1, which also fixes the issue.

Alternatively I could bump both jpeg and mjpeg?
mpegps_probe looks like it has some heuristics to come up with its scores,
which may make it brittle.

-- 

Nikolas Bowe |  SWE |  nb...@google.com |  408-565-5137
From ab42e2041ec1469f43bccbf8c3e06084bbb7985a Mon Sep 17 00:00:00 2001
From: Nikolas Bowe <nb...@google.com>
Date: Thu, 8 Aug 2019 15:32:51 -0700
Subject: [PATCH] avformat: Fix probing on some JPEGs

Fixes "Invalid data found when processing input" on some JPEGs.

Some large extensionless JPEGs can get probe score collisions with mpeg
eg
$ ffprobe -loglevel trace  /tmp/foo
[NULL @ 0x55c130ab04c0] Opening '/tmp/foo' for reading
[file @ 0x55c130ab0f40] Setting default whitelist 'file,crypto'
Probing jpeg_pipe score:6 size:2048
Probing jpeg_pipe score:6 size:4096
Probing jpeg_pipe score:6 size:8192
Probing jpeg_pipe score:6 size:16384
Probing jpeg_pipe score:25 size:32768
Probing jpeg_pipe score:25 size:65536
Probing jpeg_pipe score:25 size:131072
Probing jpeg_pipe score:25 size:262144
Probing jpeg_pipe score:25 size:524288
Probing mpeg score:25 size:1048576
Probing jpeg_pipe score:25 size:1048576
[AVIOContext @ 0x55c130ab9300] Statistics: 1048576 bytes read, 0 seeks
/tmp/foo: Invalid data found when processing input

This patch fixes this by reducing probe score for mpeg
---
 libavformat/mpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 3205f209e6..7a7de54894 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -100,7 +100,7 @@ static int mpegps_probe(const AVProbeData *p)
     }
 
     if (vid + audio > invalid + 1) /* invalid VDR files nd short PES streams */
-        score = AVPROBE_SCORE_EXTENSION / 2;
+        score = AVPROBE_SCORE_EXTENSION / 2 - 1; // 1 less than jpeg in SOS
 
 //     av_log(NULL, AV_LOG_ERROR, "vid:%d aud:%d sys:%d pspack:%d invalid:%d size:%d \n",
 //            vid, audio, sys, pspack, invalid, p->buf_size);
-- 
2.23.0.rc1.153.gdeed80330f-goog

_______________________________________________
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".

Reply via email to