[FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs
Michael Niedermayer
michael at niedermayer.cc
Thu Aug 22 10:24:04 EEST 2019
On Wed, Aug 21, 2019 at 01:58:52PM -0700, Niki Bowe wrote:
> On Mon, Aug 19, 2019 at 7:22 PM Carl Eugen Hoyos <ceffmpeg at 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 | nbowe at google.com | 408-565-5137
> mpeg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 9bfc9441a3a3a2c060005d42fda9128ff39406ef 0001-avformat-Fix-probing-on-some-JPEGs.patch
> From ab42e2041ec1469f43bccbf8c3e06084bbb7985a Mon Sep 17 00:00:00 2001
> From: Nikolas Bowe <nbowe at 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
>
jpeg and mpeg are quite different on the syntax side. Have you checked
if that jpeg file violates some easy checkable property that mpeg files
have ?
it would be better to make the detection better and more robust.
tuning the scores has a good chance of just moving the problem elsewhere
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20190822/cf76da8c/attachment.sig>
More information about the ffmpeg-devel
mailing list