[FFmpeg-devel] [PATCH] avformat: Fix probing on some JPEGs

Niki Bowe nbowe at google.com
Sat Aug 24 02:03:10 EEST 2019


On Thu, Aug 22, 2019 at 2:30 AM Paul B Mahol <onemda at gmail.com> wrote:

> On Thu, Aug 22, 2019 at 11:19 AM Carl Eugen Hoyos <ceffmpeg at gmail.com>
> wrote:
>
> > Am Mi., 21. Aug. 2019 um 23:05 Uhr schrieb Niki Bowe
> > <nbowe-at-google.com at ffmpeg.org>:
> > >
> > > 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.
> >
> > Sorry, I misread the original report, it looked to me as if mJpeg was
> > the culprit.
> >
> > Imo, the mpeg probing should be fixed (return a smaller value) for your
> > sample
> > by detecting that it is not mpeg, not by returning a smaller value for
> > all samples.
> >
>
> 1000% agree.
>
>
It didn't return a smaller value for all samples, only the "invalid VDR
files and short PES streams" case.
Most mpegps files still return 26 immediately, because they have pack
headers.

However, here is another patch where I try to limit it to only changing
score for these jpegs.
I noticed that these jpegs had a lot of 0x00000100 sequences, which matches
mpeg picture header start code. I added another heuristic which matches
these jpegs, but not any mpegps files I could find.

Alternatively I could make reduce score if it doesn't start with a start
code? At the moment its happy to search until it finds start codes.


Is everyone really sure the best approach is to modify mpegps_probe for
this?
The mpegps_probe function returns 25 in many instances where it may not be
mpegps. It does only minimal structural checking, and allows invalid data
to still classify as mpegps.
jpeg probing returns 25 in some cases where it is almost certainly a jpeg
(Has to go through multiple tags to get to SOS, many of which early out if
they find invalid data).
Note that 25 is still treated as "low confidence" for jpeg. It logs "Format
jpeg_pipe detected only with low score of 25, misdetection possible!" for
these jpegs.
So I still think a score of 25 is too low for these jpegs, and that a
better fix would be to return 26 for jpeg_pipe and mjpeg if it makes it
past multiple tags to SOS.

-- 

Nikolas Bowe |  SWE |  nbowe at google.com |  408-565-5137
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-avformat-Fix-probing-on-some-JPEGs.patch
Type: text/x-patch
Size: 3027 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190823/3b5e87c2/attachment.bin>


More information about the ffmpeg-devel mailing list