Description
Cannot speedup Android encoding with mediacodec?
When I use-hwaccel mediacodec -i <video_input> -c:v h264_mediacodec <video_output i get the error E/mobile-ffmpeg: Unknown encoder 'h264_mediacodec'
Is this because there is no support for hwaccel encoders in Android according to the wiki.
Is there a way to speed up my encoding process? I already read through #197
Expected behavior
Speed up decoding (which seems to work) and encoding time in Android
Current behavior
Error: E/mobile-ffmpeg: Unknown encoder 'h264_mediacodec'
Screenshots
n/a
Logs
-hwaccel mediacodec -i input.mp4 -c:v h264_mediacodec -an output.mp4
E/mobile-ffmpeg: Unknown encoder 'h264_mediacodec'
Environment
Other
I have a very low speed even if I use libx264 as encoder and even if I set the flag -preset ultrafast.
Thanks for your work!
Is this because there is no support for hwaccel encoders in Android according to the wiki.
Yes, MediaCodec encoder is not implemented by ffmpeg, only decoder is available.
Is there a way to speed up my encoding process? I already read through #197
There does not exist a magic option/flag to improve the speed. Using CPU optimizations makes the biggest difference for encoding/decoding.
You can ask this question in ffmpeg mailing list too. FFmpeg developers may have different ideas on improving the encoding speed.
Still the libx264 -preset ultrafast should work even on Android right?
Thank you very much for your quick answer
Still the libx264 -preset ultrafast should work even on Android right?
Yes, it is supported on Android too.
Hello @tanersener ,
I see in the Android documentation at Supported Media Formats that h264 is available as an encoder for Android 6+.
How can I use this with mobile-ffmpeg? I tried using version 4.3.1 and 4.4 with -vcodec h264_mediacodec but I still get Unknown encoder h264_mediacodec as a response from ffmpeg.
Thank you in advance!
@galex Unfortunately h264_mediacodec encoder is not implemented by ffmpeg. See https://trac.ffmpeg.org/wiki/HWAccelIntro. MediaCodec is only available as decoder.