<div dir="ltr">Hi! I am using NVENC encoder to create h264 stream.The YUV format is NV12.<div>Now, I need also to decode that stream back to YUV.I wrote a module for that,based on</div><div>this example:</div><div><br></div><div><a href="https://gist.github.com/roxlu/9329339">https://gist.github.com/roxlu/9329339</a><br></div><div><br></div><div>But, because my YUV format is not 420P, but NV12 I am trying to force it on AVCodecContext when initializing it with this line:</div><div><br></div><div>        avcodec_register_all();</div><div>        mCodec = avcodec_find_decoder(AV_CODEC_ID_H264);</div><div>        mCodecContext = avcodec_alloc_context3(mCodec);</div><div>        mCodecContext->pix_fmt = AVPixelFormat::AV_PIX_FMT_NV12;</div><div><br></div><div><br></div><div>But when I am receiving the decoded AVFrame, I see that the AVFrame->format property is </div><div>set to zero, which is enum for 420P. Also inspecting the planes and other props of this struct I see that the decoder tried to decode it as 420P. (3 planes , 3 line sizes etc.) .And of course,when trying to play the output of such a YUV frame , there is just a green screen.</div><div>I am trying to understand where is my error.Is there some data that decoder misses from the h264 stream and it doesn't allow it to guess the pixel format?Or maybe I need to set pixel format for the codec context in a some different way? </div></div>