Why is FFMPEG not using hardware decoding on Android when using the h264_mediacodec decoder?

  android, android-mediacodec, c++, ffmpeg

I’m trying to use FFMPEG in C++ using the h264_mediacodec decoder to decode a video on Android. The frame I receive is AV_PIX_FMT_NV12 instead of AV_PIX_FMT_MEDIACODEC, which implies that the hardware decoding isn’t working.

I followed this example to set up the decoder. I tried it on Windows with h264_cuvid and it works as expected, but on Android using mediacodec, I can’t get the frame in the expected format.

Source: Windows Questions C++