diff --git a/android/README.md b/android/README.md index 40db041..658081d 100644 --- a/android/README.md +++ b/android/README.md @@ -8,7 +8,7 @@ - Builds shared native libraries (.so) - Creates Android archive with .aar extension -### 2. Building +### 2. Building (Skip this part and use prebuilt from RELEASES section) Run `android.sh` at project root directory to build `ffmpeg-kit` and `ffmpeg` shared libraries. @@ -61,10 +61,97 @@ Use `--lts` option to build lts binaries for each architecture. All libraries created by `android.sh` can be found under the `prebuilt` directory. - `Android` archive (.aar file) for `Main` builds is located under the `bundle-android-aar` folder. -- `Android` archive (.aar file) for `LTS` builds is located under the `bundle-android-aar-lts` folder. +- LTS is not supported sorry. (For Python) + +### 3. Using With Python +1) Add the aar from Releases tab or the one generated by you to your projects folder. +2) In Buildozer spec file add jnius to requirements and the aar file. +``` +requirements = jnius +android.add_aars = ffmpeg-kit-release.aar +``` +3) Using Pyjnius, declare the variables in Python (https://pyjnius.readthedocs.io/en/stable/) +``` +#IMPORTING jnius +from jnius import autoclass +from jnius import * +#Declaring Variable so it can be used +FFMPEG = autoclass('com.sahib.pyff.ffpy') +``` + +BOTH (FFMPEG and FFPROBE) RETURN OUTPUT OF THE COMMAND +4) To Use FFMPEG +``` +#EXECUTED FFMPEG COMMAND, COMMAND IS STRING +ffmpegCommand = FFMPEG.Run("COMMAND") + +#PRINTS RETURN (OUTPUT OF THE COMMAND) +print(ffmpegCommand) +``` + +5) To use FFProbe +``` +#EXECUTED FFProbe COMMAND, COMMAND IS STRING +probeCommand = FFMPEG.RunProbe("Command") + +#PRINTS RETURN (OUTPUT OF THE COMMAND) +print(probeCommand) + +``` +NOTE - FILTER_COMPLEX can not be used. (IDK why, if you have solution tell me please) + + + +#EXAMPLES +1) FFMPEG +``` +from jnius import autoclass +from jnius import * +#Declaring Variable so it can be used +FFMPEG = autoclass('com.sahib.pyff.ffpy') + + +#THIS COVERTS VIDEO INTO an audio file (MP4 TO WAV) +d = FFMPEG.Run(str("-i video.mp4 -ab 160k -ac 2 -ar 44100 -vn TEMP/audio.wav")) + +#THIS PRINTS THE OUTPUT (I don't think you even need output in ffmpeg unless for trouble shooting) +print(d) + +``` + + + + + +2) FFProbe +``` +from jnius import autoclass +from jnius import * +#Declaring Variable so it can be used +FFMPEG = autoclass('com.sahib.pyff.ffpy') + + +#Gets Framerate of video +frameRate = FFMPEG.RunProbe("-v error -select_streams v -of default=noprint_wrappers=1:nokey=1 -show_entries stream=r_frame_rate video.mp4") +#This command outputs 30/1 at 30 frames + +frameRate = frameRate.split("/")[0] +#this makes it 30 instead of 30/1 + +frameRate = int(frameRate) +print(frameRate) +#Converts framerate to integer and prints it + +``` + + + + +#END OF DOCUMENTATION FOR PYTHON + -### 3. Using +# With Java/ Orignal ffmpegkit's documentation (IGNORED BY ME) #### 3.1 Android API 1. Declare `mavenCentral` repository and add `FFmpegKit` dependency to your `build.gradle` in