I’ve been trying to make an Android app on Python3.12 and Kivy.
It’s been a smooth ride until I tried to download a video with yt-dlp on an actual Android device.
Turns out it can’t just use FFMPEG to convert the videos like that.
My understanding is that the only way for yt-dlp to use FFMPEG is by compiling it along with the app, for which I came across https://github.com/ArqiesAr/FFmpeg-Kit-Python#3-using-with-python .
But as I am completely unfamiliar with Java, I can’t figure out how to implement this into my code, and the README there I just don’t completely get.
As first steps provide steps to install SDK/NDK and modify the Buildozer.spec.
My understanding was that I will need Buildozer only after I write my Python code and want to compile it as an Android APK to run on the Android device.
Also, I’m completely confused with their Python usage:
#IMPORTING jnius
from jnius import autoclass
from jnius import *
#Declaring Variable so it can be used
FFMPEG = autoclass('com.sahib.pyff.ffpy')
as it will return error:
Traceback (most recent call last):
File "c:Users...kivy_projectmain.py", line 30, in <module>
FFMPEG = autoclass('com.sahib.pyff.ffpy')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:Users...PythonPython312Libsite-packagesjniusreflect.py", line 209, in autoclass
c = find_javaclass(clsname)
^^^^^^^^^^^^^^^^^^^^^^^
File "jnius\jnius_export_func.pxi", line 22, in jnius.find_javaclass
File "jnius\jnius_utils.pxi", line 79, in jnius.check_exception
jnius.JavaException: JVM exception occurred: com/sahib/pyff/ffpy java.lang.NoClassDefFoundError
With some help from chatgpt I came to an understanding that I need some java classes at my
parent/com/sahib/pyff/ffpy, but I just don’t understand at all which and where to get them from.
Also the README says:
Building (Skip this part, its for myself lol) Run android.sh at
project root directory to build ffmpeg-kit and ffmpeg shared
libraries.
So I’m not supposed to build anything, just get some files from the Git itself?
Can someone please explain, I’m really at a loss here.