caydey / ffshare

An android app to compress image, video and audio files through ffmpeg before sharing them
GNU General Public License v3.0
615 stars 30 forks source link

Hardware acceleration #44

Closed juxuanu closed 1 year ago

juxuanu commented 1 year ago

I noticed that currently libx264 is used, which uses the CPU. I don't know if there is any abstraction available on Android, but ideally ffmpeg would use the GPU to encode a video, making the process faster and use less CPU.

I guess a first approach would be to hardcode some codec ←→ codec paths to use the GPU (for example, h264 encoding is commonly available in all GPUs), but the big elephant in the room would be how to probe the capabilities of the phone GPU, and of course fallback to CPU if anything fails or requirements for hardware acceleration aren't met, transparently.

caydey commented 1 year ago

hardware accelerated encoding usually only cares about speed as the intended use is not for size reduction and has a negative impact on the output file size. It may eventually be possible once i get around to adding custom params #8 but there wont be a specific option for it.