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
* Add it in your root build.gradle at the end of repositories:
65
+
**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.
67
66
68
-
```
67
+
**For JitPack users:** The mobile-ffmpeg dependency is automatically included when you use the JitPack dependency. No additional setup required!
68
+
69
+
### Integration Guide
70
+
71
+
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.
72
+
73
+
#### Step 1: Download the Library
74
+
* Download or clone this repository
75
+
* Copy the `SSffmpegVideoOperation` module folder to your project
76
+
77
+
#### Step 2: Integration Methods
78
+
79
+
**Option A: Using JitPack (Recommended - Simple One-Line Integration)**
80
+
81
+
This is the easiest way to integrate the library. JitPack will build the library along with the mobile-ffmpeg dependency automatically.
82
+
83
+
* Add JitPack repository to your root build.gradle:
84
+
85
+
```gradle
69
86
allprojects {
70
87
repositories {
71
-
...
88
+
google()
89
+
mavenCentral()
72
90
maven { url 'https://jitpack.io' }
73
91
}
74
92
}
75
93
```
76
94
77
-
* Add the dependency in your app's build.gradle file
95
+
* Add the dependency in your app's build.gradle file:
This is all you have to do to load the FFmpeg library.
103
+
**That's it!** JitPack will automatically handle the mobile-ffmpeg.aar dependency that's included in this repository. No additional configuration needed.
104
+
105
+
**Option B: Local Integration (For Customization)**
106
+
107
+
If you want to modify the library or integrate it locally, follow these steps:
108
+
109
+
1.**Add the library module to your `settings.gradle`:**
110
+
```gradle
111
+
include ':app', ':SSffmpegVideoOperation'
112
+
// If the SSffmpegVideoOperation folder is in a different location:
113
+
// project(':SSffmpegVideoOperation').projectDir = new File('path/to/SSffmpegVideoOperation')
114
+
```
115
+
116
+
2.**Configure repositories in your app's `build.gradle`:**
117
+
```gradle
118
+
android {
119
+
// ... your existing configuration
120
+
}
121
+
122
+
repositories {
123
+
google()
124
+
mavenCentral()
125
+
flatDir {
126
+
dirs '../SSffmpegVideoOperation/libs'
127
+
}
128
+
}
129
+
130
+
dependencies {
131
+
implementation project(':SSffmpegVideoOperation')
132
+
// ... your other dependencies
133
+
}
134
+
```
135
+
136
+
3.**The SSffmpegVideoOperation module is already configured with:**
137
+
-`libs/mobile-ffmpeg.aar` - The full version of mobile-ffmpeg
138
+
- Proper repository configuration in its `build.gradle`:
139
+
```gradle
140
+
repositories {
141
+
flatDir {
142
+
dirs 'libs'
143
+
}
144
+
}
145
+
146
+
dependencies {
147
+
implementation(name: 'mobile-ffmpeg', ext: 'aar')
148
+
// ... other dependencies
149
+
}
150
+
```
151
+
152
+
**Important Notes:**
153
+
- The `mobile-ffmpeg.aar` file is already included in `SSffmpegVideoOperation/libs/`
154
+
- No additional setup is required for the AAR dependency
155
+
- The library uses `flatDir` repository to resolve the local AAR file
156
+
- Make sure to sync your project after adding the module
157
+
158
+
## How JitPack Integration Works
159
+
160
+
When you use the JitPack dependency (`implementation 'com.github.SimformSolutionsPvtLtd:SSffmpegVideoOperation:1.0.8'`):
161
+
162
+
1. **JitPack automatically builds** your library from the GitHub repository
163
+
2. **Includes mobile-ffmpeg.aar** - The AAR file in `SSffmpegVideoOperation/libs/` is packaged with the library
164
+
3. **Resolves dependencies** - All transitive dependencies are handled automatically
165
+
4. **No local setup needed** - Users don't need to manually handle AAR files or repository configurations
166
+
167
+
This approach gives you the best of both worlds:
168
+
- **Simple integration** for users via JitPack
169
+
- **Full control** over the mobile-ffmpeg dependency
170
+
- **No external dependencies** on repositories that might change or become unavailable
171
+
172
+
#### Step 3: Add Required Permissions
173
+
Add these permissions to your AndroidManifest.xml:
#### Step 4: ProGuard Configuration (if using ProGuard/R8)
182
+
Add these rules to your proguard-rules.pro:
183
+
```
184
+
-keep class com.arthenica.mobileffmpeg.** { *; }
185
+
-keep class com.simform.videooperations.** { *; }
186
+
```
187
+
188
+
This setup ensures proper AAR dependency resolution and avoids the "Direct local .aar file dependencies are not supported" error when building AAR libraries.
86
189
87
190
### Run FFmpeg command
88
191
In this sample code we will run the FFmpeg -version command in background call.
signingConfig signingConfigs.debug // Use debug signing for testing
275
+
// For production, create and use a proper release keystore
276
+
}
277
+
}
278
+
}
279
+
```
280
+
281
+
#### 3. Build Sync Issues
282
+
**Solution:**
283
+
- Make sure the SSffmpegVideoOperation module is properly included in settings.gradle
284
+
- Verify the module path is correct
285
+
- Clean and rebuild the project
286
+
287
+
#### 4. FFmpeg Commands Not Working
288
+
**Solution:**
289
+
- Check if you have the required permissions
290
+
- Ensure input and output file paths are correct and accessible
291
+
- Verify the FFmpeg command syntax
292
+
293
+
#### 5. Memory Issues with Large Videos
294
+
**Solution:**
295
+
- Process videos in smaller chunks
296
+
- Use appropriate compression settings
297
+
- Consider using background processing for large files
298
+
299
+
#### 6. "flatDir should be avoided" Warning
300
+
**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.
301
+
141
302
## Medium Blog
142
303
For more info go to __[Multimedia Operations for Android using FFmpeg](https://medium.com/simform-engineering/multimedia-operations-for-android-using-ffmpeg-78f1fb480a83)__
0 commit comments