项目
在 GitHub 查看
a914-gowtham/android-video-trimmer
关于
Helps to trim local videos with compress option on Android applications using Exoplayer and media3 libraries
开发工具实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Starting from 1.8.0 this library is using media3 for media transcoding. Previously it was using ffmpeg which is deprecated now.
Android-video-trimmer
Helps to trim local videos with many customizations on Android applications using exoplayer2 and FFmpeg Demo app

How to use
For a working implementation, please have a look at the Sample Project
- Include the library as local library project.
- Add the dependency to your app
build.gradlefile
// replace x.y.z with latest available jitpack version
dependencies {
implementation 'com.github.a914-gowtham:android-video-trimmer:x.y.z'
}
- Add to project's root
build.gradlefile:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Create a global variable for ActivityResultLauncher
//Java
ActivityResultLauncher<Intent> startForResult = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == Activity.RESULT_OK &&
result.getData() != null) {
Uri uri = Uri.parse(TrimVideo.getTrimmedVideoPath(result.getData()));
Log.d(TAG, "Trimmed path:: " + uri);
} else
LogMessage.v("videoTrimResultLauncher data is null");
});
//Kotlin
val startForResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
result: ActivityResult ->
if (result.resultCode == Activity.RESULT_OK &&
result.getData() != null) {
Uri uri = Uri.parse(TrimVideo.getTrimmedVideoPath(result.getData()))
Log.d(TAG, "Trimmed path:: " + uri)
}else
LogMessage.v("videoTrimResultLauncher data is null");
}
- Add the code for opening Trim Activity.
TrimVideo.activity(String.valueOf(videoUri))
.setHideSeekBar(true)
.disableCompression() // to disable compression ui. enabled by default
.start(this,startForResult);
Custom TrimTypes
TrimType Default:
TrimVideo.activity(videoUri)
.start(this,startForResult);
TrimType Fixed Duration:
TrimVideo.activity(videoUri)
.setTrimType(TrimType.FIXED_DURATION)
.setFixedDuration(30) //seconds
.start(this,startForResult);
TrimType Minimum Duration:
TrimVideo.activity(videoUri)
.setTrimType(TrimType.MIN_DURATION)
.setMinDuration(30) //seconds
.start(this,startForResult);
TrimType Min-Max Duration:
TrimVideo.activity(videoUri)
.setTrimType(TrimType.MIN_MAX_DURATION)
.setMinToMax(10, 30) //seconds
.start(this,startForResult);
Proguard Rules
-dontwarn com.gowtham.library**
-keep class com.gowtham.library** { *; }
-keep interface com.gowtham.library** { *; }
Development roadmap:
- Currently, compression only reduces the bitRate to reduce the file size. converting video to the selected resolution is in under development - DONE
- Showing file size estimation in toolbar subtitle - to be worked
Compatibility
- Library - Android Nougat 7.0+ (API 24)
- Sample - Android Kitkat 4.4+ (API 19)
License
This library is licensed under the MIT License.
Support
Show your support by giving a star to this repository.
Collaboration
There are many ways of improving and adding more features, so feel free to collaborate with ideas, issues and/or pull requests.
探索相关项目
加载中…