[FFmpeg-devel] [PATCH 2/2] img2dec: Add mime_type to image formats

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Feb 25 18:06:10 CET 2016


On 2/25/2016 4:30 PM, Carl Eugen Hoyos wrote:

Replies are mine.

>> In terms of how the score for a MIME type match compares with 
>> those of the individual content matching probe functions, I'd 
>> say it makes sense. The stronger probing functions have a 
>> score which reflects their reliability.
> 
> But even _EXTENSION + 1 is correct in practically all cases 
> (the exception are mpeg streams that start with the needed four 
> bytes) and should not be beaten by mime_type.

URLs with no extension at all, or extensions with query params
after them are very normal. This argument is silly.

>> Improves probing, especially over http when there is a 
>> Content-Type header
> 
> Please give an example of a failing stream.
> If you cannot share, please provide console output and 
> hexdump of the relevant bytes.

... your argument is "it's not 100% broken so let's not
improve it"? Really?

> If this cannot be fixed differently, we should either increase 
> the score for the existing 32bit probe functions or reduce the 
> score for mime types before this gets applied. Several probe 
> functions (outside of img2dec.c) return MAX for 32 bits, I just 
> wanted to give problematic mpeg streams a better chance to get 
> detected.

[...]

> The alternative is to only use mime type for jpeg: I am 
> assuming this is the only problematic case, note that we have 
> to make sure it's not mjpeg, that's why the probe function is 
> so long.

Um, what? Why the heck would you only use mime-type for JPEG?
It is definitely not the only problematic case, and this sounds
utterly silly.

>> If a MIME type is specified, that does have significant weight 
>> in terms of probability, given that it was set somewhere either 
>> by a client or server program doing a content check or 
>> explicitly by some user.
> 
> Wouldn't the server simply run "file" doing less checks than we 
> already do now? (If it doesn't trust the extension.)

No. This is especially not true on modern CDNs (such as AWS or
GCS), where files are stored as 'blob's and mimetype can be
set properly during the push to storage. It's not 1999 anymore.

- Derek


More information about the ffmpeg-devel mailing list