VideoProcessor
process video(cut & scale & increase & decrease & reverse) with mediacodec
Install / Use
/learn @yellowcath/VideoProcessorREADME
VideoProcessor
VideoProcessor使用Android原生的MediaCodec实现视频压缩、剪辑、混音、快慢放及倒流的功能(快慢放及倒流支持音频同步变化),在支持MediaCodec的手机上优于使用FFmpeg的方案
- 体积小 :编译后的aar只有262K,ffmpeg一个so就7、8M,精简之后也差不多还有一半大小
- 速度快 :在huaweiP9上压缩(1080P 20s 20000k -> 720p 2000k)
lib | 耗时 ------ | ------ VideoProcessor| 13.3s ffmpeg | 172s ffmpeg(ultrafast) | 74s
Gradle
在根目录下的build.gradle里添加maven仓库
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
添加依赖 要求minSdkVersion 21
dependencies {
implementation 'com.github.yellowcath:VideoProcessor:2.4.2'
}
Changelog
2.4.2
- 解决arm64的机器上crash的问题
- 解决某些情况下进度计算错误的问题
2.4.0
- 兼容Android Q
- 去掉对support lib的依赖
使用
基本用法如下
VideoProcessor.processor(context)
.input(inputVideoPath)
.output(outputVideoPath)
.outWidth(outWidth)
.outHeight(outHeight)
.process();
VideoProcessor支持多种参数同时处理,完整参数如下
VideoProcessor.processor(context)
.input(inputVideoPath) // .input(inputVideoUri)
.output(outputVideoPath)
//以下参数全部为可选
.outWidth(width)
.outHeight(height)
.startTimeMs(startTimeMs)//用于剪辑视频
.endTimeMs(endTimeMs) //用于剪辑视频
.speed(speed) //改变视频速率,用于快慢放
.changeAudioSpeed(changeAudioSpeed) //改变视频速率时,音频是否同步变化
.bitrate(bitrate) //输出视频比特率
.frameRate(frameRate) //帧率
.iFrameInterval(iFrameInterval) //关键帧距,为0时可输出全关键帧视频(部分机器上需为-1)
.progressListener(listener) //可输出视频处理进度
.process();
用户使用时可自行根据需要调用,例如
//视频两倍速
VideoProcessor.processor(context)
.input(inputVideoPath)
.output(outputVideoPath)
.speed(2.0f)
.process();
此外,其它功能
//视频逆序
VideoProcessor.reverseVideo(context, inputVideoPath, outputVideoPath,reverseAudio,listener);
//混音,支持渐入渐出
VideoProcessor.mixAudioTrack(context, inputVideoPath, aacAudioPath, outputVideoPath, startMs, endMs, videoVolume, audioVolume,fadeInSec, fadeOutSec);
Demo

Related Skills
qqbot-channel
351.2kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
100.5k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
351.2kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
Design
Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t
