[FFmpeg-user] Levels and Primaries

Robert Krüger krueger at lesspain.de
Wed Feb 12 12:33:59 CET 2014

On Wed, Feb 12, 2014 at 12:11 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Rio Kierkels <riokierkels <at> gmail.com> writes:
>> Could be just my paranoia, but I always have the feeling
>> that the decoder does some magic on the numbers or something.
> (This may now be the terminology problem in the other
> direction.)
> Concerning the decoder, I suspect that there actually is a
> guarantee that an MPEG decoder in FFmpeg really only
> outputs MPEG levels (unless told otherwise).

Really? I would expect it to return the luminance byte that was
encoded (for 8 bit) regardless of whether it is in broadcast range or
full range. I just tried to find something in the MPEG2 spec on that
but did not. If you have any sources on that, I would be interested.

> But is that really your question?
>> Which is why right now I'm also not certain what
>> I'm looking for in the output.
> I thought you are looking for levels from 0 to 15 and
> 236 to 255 (but as said, I may just not understand the
> problem that you say don't exist).
>> I think it's on a byte level.
> Of course?
>> So yeah if I've got the time I'll be going through
>> the mxf files byte by byte...
> Why not rawvideo which would make the task
> indefinitely easier imo?

If he suspects the decoder to mess things up (which I think is not the
case) raw video won't help.

I think the easiest thing to get this resolved would be if someone
like Michael just said if the MPEG de/encoders (or any other
de/encoders they know) manipulate levels when de/encoding or if they
don't (which I would expect at least for the codecs I know). Then IMHO
the easiest thing for Rio to do to be completely sure would be to set
a breakpoint where the frame is decoded in ffmpeg (Rio, let me know if
you need help finding the right line) and look at the decoded
luminance bytes in the debugger (or, if you do not want to use a
debuger, hack your own log statements into the code to output
individual pixel values, if you encode/decode an all black or white
picture I guess you really only need to output the first luma value).

More information about the ffmpeg-user mailing list