FFmpeg compiled for Android. Execute FFmpeg commands with ease in your Android app.
This project is provide in-build FFmpeg operation queries:
![]() |
![]() |
![]() |
- Cut video using time
- Convert image to video
- Add water mark on video
- Add text on video
- Combine image image and video
- Combine images
- Combine videos
- Compress a video
- Extract frames from video
- Fast/Slow motion video
- Reverse video
- video fade in / fade out
- Compress video to GIF
- Rotate and Flip video (Mirroring)
- Remove audio from video
- Update aspect ratio of video
- Merge GIFs
- Merge Audios
- Update audio volume
- Fast/Slow audio
- Crop audio using time
- Compress Audio
FFmpeg Android runs on the following architectures:
- arm-v7a, arm-v7a-neon, arm64-v8a, x86 and x86_64
- Enabled network capabilities
- Multi-threading
- Supports zlib and Media-codec system libraries
- Camera access on supported devices
- Supports API Level 24+
- 30
Note: This library includes the mobile-ffmpeg.aar file (full version) in the SSffmpegVideoOperation/libs/ directory. The full version includes all FFmpeg features and codecs needed for comprehensive video operations.
For JitPack users: The mobile-ffmpeg dependency is automatically included when you use the JitPack dependency. No additional setup required!
This library uses the mobile-ffmpeg AAR dependency which is included in the library's libs folder. Follow these simple steps to integrate the library into your project.
- Download or clone this repository
- Copy the
SSffmpegVideoOperationmodule folder to your project
Option A: Using JitPack (Recommended - Simple One-Line Integration)
This is the easiest way to integrate the library. JitPack will build the library along with the mobile-ffmpeg dependency automatically.
-
Add JitPack repository to your root build.gradle:
allprojects { repositories { google() mavenCentral() maven { url 'https://jitpack.io' } } }
-
Add the dependency in your app's build.gradle file:
dependencies { implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.8' }
That's it! JitPack will automatically handle the mobile-ffmpeg.aar dependency that's included in this repository. No additional configuration needed.
Option B: Local Integration (For Customization)
If you want to modify the library or integrate it locally, follow these steps:
-
Add the library module to your
settings.gradle:include ':app', ':SSffmpegVideoOperation' // If the SSffmpegVideoOperation folder is in a different location: // project(':SSffmpegVideoOperation').projectDir = new File('path/to/SSffmpegVideoOperation')
-
Configure repositories in your app's
build.gradle:android { // ... your existing configuration } repositories { google() mavenCentral() flatDir { dirs '../SSffmpegVideoOperation/libs' } } dependencies { implementation project(':SSffmpegVideoOperation') // ... your other dependencies }
-
The SSffmpegVideoOperation module is already configured with:
libs/mobile-ffmpeg.aar- The full version of mobile-ffmpeg- Proper repository configuration in its
build.gradle:repositories { flatDir { dirs 'libs' } } dependencies { implementation(name: 'mobile-ffmpeg', ext: 'aar') // ... other dependencies }
Important Notes:
- The
mobile-ffmpeg.aarfile is already included inSSffmpegVideoOperation/libs/ - No additional setup is required for the AAR dependency
- The library uses
flatDirrepository to resolve the local AAR file - Make sure to sync your project after adding the module
When you use the JitPack dependency (implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.8'):
- JitPack automatically builds your library from the GitHub repository
- Includes mobile-ffmpeg.aar - The AAR file in
SSffmpegVideoOperation/libs/is packaged with the library - Resolves dependencies - All transitive dependencies are handled automatically
- No local setup needed - Users don't need to manually handle AAR files or repository configurations
This approach gives you the best of both worlds:
- Simple integration for users via JitPack
- Full control over the mobile-ffmpeg dependency
- No external dependencies on repositories that might change or become unavailable
Add these permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />Add these rules to your proguard-rules.pro:
-keep class com.arthenica.mobileffmpeg.** { *; }
-keep class com.simform.videooperations.** { *; }
This setup ensures proper AAR dependency resolution and avoids the "Direct local .aar file dependencies are not supported" error when building AAR libraries.
In this sample code we will run the FFmpeg -version command in background call.
val query:Array<String> = "-i, input,....,...., outout"
CallBackOfQuery().callQuery(query, object : FFmpegCallBack {
override fun statisticsProcess(statistics: Statistics) {
Log.i("FFMPEG LOG : ", statistics.videoFrameNumber)
}
override fun process(logMessage: LogMessage) {
Log.i("FFMPEG LOG : ", logMessage.text)
}
override fun success() {
}
override fun cancel() {
}
override fun failed() {
}
})val startTimeString = "00:01:00" (HH:MM:SS)
val endTimeString = "00:02:00" (HH:MM:SS)
val query:Array<String> = FFmpegQueryExtension().cutVideo(inputPath, startTimeString, endTimeString, outputPath)
CallBackOfQuery().callQuery(query, object : FFmpegCallBack {
override fun statisticsProcess(statistics: Statistics) {
Log.i("FFMPEG LOG : ", statistics.videoFrameNumber)
}
override fun process(logMessage: LogMessage) {
Log.i("FFMPEG LOG : ", logMessage.text)
}
override fun success() {
//Output = outputPath
}
override fun cancel() {
}
override fun failed() {
}
})same for other queries. And you can apply your query also
Solution:
- Ensure the
SSffmpegVideoOperation/libs/mobile-ffmpeg.aarfile exists - Check that your app's build.gradle has the correct flatDir repository configuration:
repositories { flatDir { dirs '../SSffmpegVideoOperation/libs' } }
Solution: Ensure your release builds are properly signed. Add signing configuration to your app's build.gradle:
android {
signingConfigs {
debug {
storeFile file("${System.getProperty('user.home')}/.android/debug.keystore")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
}
buildTypes {
release {
signingConfig signingConfigs.debug // Use debug signing for testing
// For production, create and use a proper release keystore
}
}
}Solution:
- Make sure the SSffmpegVideoOperation module is properly included in settings.gradle
- Verify the module path is correct
- Clean and rebuild the project
Solution:
- Check if you have the required permissions
- Ensure input and output file paths are correct and accessible
- Verify the FFmpeg command syntax
Solution:
- Process videos in smaller chunks
- Use appropriate compression settings
- Consider using background processing for large files
Solution: This warning can be ignored. While flatDir is not the recommended approach for published libraries, it's acceptable for local AAR dependencies and works reliably for this use case.
For more info go to Multimedia Operations for Android using FFmpeg
Support it by joining stargazers for this repository. β
- Check out our other available awesome mobile libraries
Copyright 2021 Simform Solutions
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


