You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is there a way to include ffmpeg in an Android app? #3137
Hi, I'm working on an Android app using kivy and buildozer. The app focuses on video and audio editing, similar to CapCut and relies on FFmpeg as its backbone for processing. On Windows, I use a system-installed FFmpeg (the one you download and add to the system PATH) and call it using subprocess commands. This setup works perfectly.
However, since the FFmpeg package you install with pip on Windows doesn't meet my app needs, I'm assuming adding FFmpeg to the requirements in the buildozer.spec file wouldn't work.
Is there a way to include the full build FFmpeg in my Android app?
Are there alternative ways to integrate FFmpeg with Kivy/Buildozer that work well on Android?
Yes you can get ffmpeg binary in android, you need to modify its recipe to include binary as .so file in android lib dir then load that .so as bin file.
👋 @Rotgal,
Sorry to hear you are having difficulties with Kivy's python-for-android; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to python-for-android.
However, this issue appears to be a support request. Please use our support channels to get help with the project.
If you're having trouble installing python-for-android, please see our quickstart guide.
If you're having trouble using python-for-android, please see our troubleshooting guide and FAQ.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.
Yes you can get ffmpeg binary in android, you need to modify its recipe to include binary as .so file in android lib dir then load that .so as bin file.
It could also be updating some configure/build flags so that the binary is built.
For instance in the recipe there's:
Go play with this a bit.
However we probably don't want to ship if for everyone as it would increase build size, so maybe with a custom recipe or something
Am I supposed to modify the recipe here /.buildozer/android/platform/python-for-android/pythonforandroid/recipes/ffmpeg? And should I run buildozer android clean afterwards?
It works by copying ffmpeg executable file to libffmpegbin.so so it get's automatically copied to android lib dir and from there we can execute it. We cannot execute it in any another path or with any other name due to android restrictions.
So it kinda impersonates executable file as library.
Activity
T-Dynamos commentedon Mar 29, 2025
Yes you can get ffmpeg binary in android, you need to modify its recipe to include binary as .so file in android lib dir then load that .so as bin file.
github-actions commentedon Mar 29, 2025
👋 @Rotgal,
Sorry to hear you are having difficulties with Kivy's python-for-android; Kivy unites a number of different technologies, so building apps can be temperamental.
We try to use GitHub issues only to track work for developers to do to fix bugs and add new features to python-for-android.
However, this issue appears to be a support request. Please use our support channels to get help with the project.
If you're having trouble installing python-for-android, please see our quickstart guide.
If you're having trouble using python-for-android, please see our troubleshooting guide and FAQ.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.
abdullah213141 commentedon Mar 29, 2025
Can you elaborate a bit? Am I supposed to use this recipe or use something like ffmpeg-kit? Any documentations/tutorials would be appreciated
T-Dynamos commentedon Mar 29, 2025
@ElliotGarbus I think this was not a support request?
It was a feature request: "Expose ffmpeg binary"
ElliotGarbus commentedon Mar 29, 2025
@T-Dynamos
I don't understand. There is already a recipe for ffmpeg. This seems like a rather straight forward support request. What an I missing?
PitRc47 commentedon Mar 30, 2025
This question troubles me as well.
I was able to compile ffmpeg as an .so library, but I don't seem to have a way to execute it.
Is my knowledge lacking somewhere?
AndreMiras commentedon Mar 30, 2025
This is what @T-Dynamos said basically:
It could also be updating some configure/build flags so that the binary is built.
For instance in the recipe there's:
Go play with this a bit.
However we probably don't want to ship if for everyone as it would increase build size, so maybe with a custom recipe or something
abdullah213141 commentedon Mar 30, 2025
Am I supposed to modify the recipe here
/.buildozer/android/platform/python-for-android/pythonforandroid/recipes/ffmpeg? And should I runbuildozer android cleanafterwards?T-Dynamos commentedon Mar 30, 2025
Here is my hacky tmp fix: https://github.com/T-Dynamos/python-for-android/tree/ffmpeg_bin
To use it:
in
buildozer.spec:To run ffmpeg bin in android:
(test code):
It works by copying
ffmpegexecutable file tolibffmpegbin.soso it get's automatically copied to android lib dir and from there we can execute it. We cannot execute it in any another path or with any other name due to android restrictions.So it kinda impersonates executable file as library.