Skip to content

Video stream in YUV420P looks a bit whitish #337

Answered by lukasf
yikuo123 asked this question in Q&A
Discussion options

You must be logged in to vote

Your frames have pix format AV_PIX_FMT_YUVJ420P, which means that it has full color range (0-255). Normal mpeg color range is 16-235. The MediaPlayer will assume that your frames have normal mpeg color range, so it will expand the 16-235 range to 0-255, which causes the loss of all details very bright and very dark areas.

You must set the MF_MT_VIDEO_NOMINAL_RANGE attribute to make MediaPlayer aware of the actual color range.

This is how we do it in our UncompressedVideoSampleProvider:

    if (codecPar->color_range != AVCOL_RANGE_UNSPECIFIED)
    {
        MFNominalRange nominalRange{ codecPar->color_range == AVCOL_RANGE_JPEG ? MFNominalRange_0_255 : MFNominalRange_16_235 };
        prope…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@yikuo123
Comment options

@lukasf
Comment options

Answer selected by yikuo123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants