xuexiangjys / Xvideo
一个能自动进行压缩的小视频录制库
Stars: ✭ 90
Programming Languages
c
50402 projects - #5 most used programming language
Projects that are alternatives of or similar to Xvideo
Ffmpegandroidlibrary
One line integration for FFMPEG Library in Android
Stars: ✭ 88 (-2.22%)
Mutual labels: gradle, ffmpeg
Hidden Secrets Gradle Plugin
🔒 Deeply hide secrets on Android
Stars: ✭ 79 (-12.22%)
Mutual labels: gradle
Circleci Orbs
The source code for some of the orbs published by CircleCI
Stars: ✭ 82 (-8.89%)
Mutual labels: gradle
Gradle Buildconfig Plugin
A plugin for generating BuildConstants for any kind of Gradle projects: Java, Kotlin, Groovy, etc. Designed for KTS scripts.
Stars: ✭ 85 (-5.56%)
Mutual labels: gradle
Abr Broadcaster
A real time encoder for Adaptive Bitrate Broadcast
Stars: ✭ 80 (-11.11%)
Mutual labels: ffmpeg
Ffpyplayer
A cython implementation of an ffmpeg based player.
Stars: ✭ 89 (-1.11%)
Mutual labels: ffmpeg
Appstorelibrary
Android AppStore library for Play, Amazon, and OneStore(one of the korean appstore) app store
Stars: ✭ 86 (-4.44%)
Mutual labels: gradle
Androidanimationexercise
Android 动画各种实现,包括帧动画、补间动画和属性动画的总结分享
Stars: ✭ 1,254 (+1293.33%)
Mutual labels: gradle
Hex Arch Kotlin Spring Boot
Reference JVM multi module project for a reactive micro service and lambda using a hexagonal architecture, DDD, Kotlin, Spring Boot, Quarkus, Lambda, Gradle.
Stars: ✭ 83 (-7.78%)
Mutual labels: gradle
Blog
Android 面试宝典、数据结构和算法、音视频 (FFmpeg、AAC、x264、MediaCodec)、 C/C++ 、OpenCV、跨平台等学习记录。【0基础音视频进阶学习路线】
Stars: ✭ 1,263 (+1303.33%)
Mutual labels: ffmpeg
Gradle Util Plugins
Fix for windows gradle long classpath issue. Fixes JavaExec tasks that error out with message "CreateProcess error=206, The filename or extension is too long"
Stars: ✭ 87 (-3.33%)
Mutual labels: gradle
Namava Downloader
Download movies from `namava.ir` website. | لینک جایگزین جهت احتیاط: https://gitlab.com/NabiKAZ/namava-downloader
Stars: ✭ 89 (-1.11%)
Mutual labels: ffmpeg
Easypermissions Android
A simple library that will remove all the boilerplate code and speed up your work with new Runtime Permissions introduced in Android M.
Stars: ✭ 85 (-5.56%)
Mutual labels: gradle
XVideo
一个能自动进行压缩的小视频录制库
关于我
特征
-
支持自定义小视频录制时的视频质量。
-
支持自定义视频录制的界面。
-
支持自定义最大录制时长和最小录制时长。
-
支持自定义属性的视频压缩。
演示(请star支持)
Demo下载
添加Gradle依赖
1.在项目根目录的 build.gradle 的 repositories 添加:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
2.在主项目的 build.gradle 中增加依赖。
dependencies {
···
implementation 'com.github.xuexiangjys:XVideo:1.0.2'
}
3.进行视频录制存储目录地址的设置。
/**
* 初始化xvideo的存放路径
*/
public static void initVideo() {
XVideo.setVideoCachePath(PathUtils.getExtDcimPath() + "/xvideo/");
// 初始化拍摄
XVideo.initialize(false, null);
}
视频录制
1.视频录制需要CAMERA
权限和STORAGE
权限。在Android6.0机器上需要动态获取权限,推荐使用XAOP进行权限申请。
2.调用MediaRecorderActivity.startVideoRecorder
开始视频录制。
/**
* 开始录制视频
* @param requestCode 请求码
*/
@Permission({PermissionConsts.CAMERA, PermissionConsts.STORAGE})
public void startVideoRecorder(int requestCode) {
MediaRecorderConfig mediaRecorderConfig = MediaRecorderConfig.newInstance();
XVideo.startVideoRecorder(this, mediaRecorderConfig, requestCode);
}
3.MediaRecorderConfig
是视频录制的配置对象,可自定义视频的宽、高、时长以及质量等。
MediaRecorderConfig config = new MediaRecorderConfig.Builder()
.fullScreen(needFull) //是否全屏
.videoWidth(needFull ? 0 : Integer.valueOf(width)) //视频的宽
.videoHeight(Integer.valueOf(height)) //视频的高
.recordTimeMax(Integer.valueOf(maxTime)) //最大录制时间
.recordTimeMin(Integer.valueOf(minTime)) //最小录制时间
.maxFrameRate(Integer.valueOf(maxFrameRate)) //最大帧率
.videoBitrate(Integer.valueOf(bitrate)) //视频码率
.captureThumbnailsTime(1)
.build();
视频压缩
使用libx264进行视频压缩。由于手机本身CPU处理能力有限的问题,在手机上进行视频压缩的效率并不是很高,大约压缩的时间需要比视频拍摄本身的时长还要长一些。
LocalMediaConfig.Builder builder = new LocalMediaConfig.Builder();
final LocalMediaConfig config = builder
.setVideoPath(path) //设置需要进行视频压缩的视频路径
.captureThumbnailsTime(1)
.doH264Compress(compressMode) //设置视频压缩的模式
.setFramerate(iRate) //帧率
.setScale(fScale) //压缩比例
.build();
CompressResult compressResult = XVideo.startCompressVideo(config);
混淆配置
-keep class com.xuexiang.xvideo.jniinterface.** { *; }
特别感谢
https://github.com/mabeijianxi/small-video-record
联系方式
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].