From patchwork Wed Aug 21 20:58:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niki Bowe X-Patchwork-Id: 14646 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2F949446927 for ; Thu, 22 Aug 2019 00:05:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0E11F68A3B2; Thu, 22 Aug 2019 00:05:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F20F0688357 for ; Thu, 22 Aug 2019 00:05:02 +0300 (EEST) Received: by mail-wm1-f42.google.com with SMTP id c5so3342992wmb.5 for ; Wed, 21 Aug 2019 14:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=gbgqL2fPA1ukAy3VtDadoK5UM4591Y/+b0LKxxorO8Q=; b=YOpzxkdZZ+PtemucvYMokceuqwleLJJjcAs6qzbMGHGITC/YY53W60fmw6hAeHP82l z9nHTXt87qHvxu/w3Awet9Cx2GvJsnVt4NGmYZ680SJkvdZiSOxtzDS+5YtOBeWCKnDJ DaAgw82irXWKorOU5EHZetvHxJTb+VKUB0OeJi9qUCVrmS6VzW+r4U+ifTbvE/Yl4AaE X97VuFZBfFRM+k7k9l8Ru6t4uEDiXfoAekKAih9VtXsTyXcnGo1QDNfDZgsH14ycryv9 R2kvfsH+dSDYX20okOtsLg+sZYt2p6CpO4MuW5NRT2F1aFHxWvUikAlkXE7L1KwjgjUu ok/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=gbgqL2fPA1ukAy3VtDadoK5UM4591Y/+b0LKxxorO8Q=; b=tF8hndJk9jf66t8ZlM4QfDWsTeYBiqXSoajgiOfws2bLHaEPcxPVQMFE1L7nsDtk+V gs/m+4Wa/dH09DkQ4SAdsjpULxC7E8mFN2pbUBok3jcgjJxkyiNAa2+vudKaAvGru0xN RWj4GEa12ZlkioMShlX5A6PNF2ZhuOgqkBFkTJbegkN/ofRKATH7nO+7zi5eI58TJvN8 6qrz2KtqVnV2BPeF86zz4aEtjKxGymGy+8Bb4wc97XaLOrtSWVrYgPggOcC7Sl3h5RCe 2k+MKl7qRjcsI43iRD/rHSgKBj8gpCwSCx8+/KRoTLjGntR2FQ+4mGeIqqBVzyZB/n1b Ujvg== X-Gm-Message-State: APjAAAVwNzGiCNli1UC2Z02x3Dwmv+9xeIiGrGkOx4MVXYjk/hww2KGd OZZSWEtgU6mZXtkbtvrbH0U/mrwQ1nxcB6wsNHXTeWzYcug= X-Google-Smtp-Source: APXvYqxrFHzMVi3FPLWxqn0VVUE2OEZyP4EJAEta1WVvFrBoWYAchytRpw65YDMW8IjVbphZKXhVKycHvBZ6YFFrw/s= X-Received: by 2002:a1c:7009:: with SMTP id l9mr2094943wmc.159.1566421144202; Wed, 21 Aug 2019 13:59:04 -0700 (PDT) MIME-Version: 1.0 References: <20190820013648.161805-1-nbowe@google.com> In-Reply-To: From: Niki Bowe Date: Wed, 21 Aug 2019 13:58:52 -0700 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Mon, Aug 19, 2019 at 7:22 PM Carl Eugen Hoyos 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. From ab42e2041ec1469f43bccbf8c3e06084bbb7985a Mon Sep 17 00:00:00 2001 From: Nikolas Bowe 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