We can do that in certain condition.
Google doesn't provide the API for native-media encoder now. If we want to do that, we need to use the code provided by the hardware company, compile the code into a .so
file, and call the function through that file in NDK.
I've found a sample provided by Qualcomm. You can find it in this link. After you download the sample, you will find a user introduction and a demo.