[FFmpeg-devel] [PATCH] avcodec/mjpeg: don't override color information from demuxer

Steinar H. Gunderson steinar+ffmpeg at gunderson.no
Wed Dec 5 10:31:48 EET 2018

On Wed, Dec 05, 2018 at 01:33:12AM +0100, Hendrik Leppkes wrote:
> The real problem is that its impossible to know which component to
> really trust. Why does a demuxer have more authority on the color
> format then a decoder? Or vice-versa?

You can make this arbitrarily complicated, of course, but if the codec
has no info apart from defaults (as in this case), I'd say the decision is
fairly simple. The one with the more specific information wins, which is the

There's a corner case where you can't specify _explicitly_ in the mux
“I don't know, but it's probably not the defaults” (since there's no
distinction between “unspecified because the format doesn't say so”
and “unspecified because the user explicitly told us to”), but I can't see
what an application would do in that case except use the codec defaults

> We don't have a solution for that, and its really something the user
> application currently has to solve.

The user application doesn't feel like the right place for this. How would it
be in a better position than FFmpeg to know? And if it really is in the
position to set a policy here, it can read out the information of the codec
parameter struct and override it, no matter what libavcodec decided to do.

/* Steinar */
Homepage: https://www.sesse.net/

More information about the ffmpeg-devel mailing list