androidffmpegandroid-mediacodecmp4parser

Is it possible to convert h265 video to h264 with resizing in Android app without the FFMPEG?


I want to convert all videos based on h265 to h264 and at the same time reduce the resolution to for example 720p to avoid working on very big resolutions and later uploading that kind of big size files.

I see docs https://developer.android.com/guide/topics/media/media-formats says that for h265 Android OS supports only decoding, not encoding.

I know that FFMPEG will solve all my problems, but including FFMPEG will increase the app size very much, I'd like to avoid that. I am trying to use currently the Android MediaCodec, but it looks like it would work fine with converting h264 to h264 but not with h265 to h264.

Do you have any ideas? I don't need to support old Android versions.

Thanks for any advice.


Solution

  • If you're compiling it for Android 12 or higher, you can use the built-in transcoder

    Otherwise, you'll need to include a 3rd-party media transcoder library, and FFMPEG is still your best choice