4 Star 5 Fork 4

落霞孤鹜/FFmpeg-Android

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
yangfeng-tomyfeng yangfeng 更新md 4bfd2cd 6 years ago
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

FFmpeg-Android

FFMpeg 在 Android中使用. 在您的Android项目中轻松执行FFmpeg命令。

关于

这个项目是 FFmpeg-Android 的延续分支。删除了FFprobe, 使so包大小减少了一半,尽量压缩项目的大小,使您的项目尽可能的小,功能尽可能的完善。

项目截图

图-1:ffmpeg_version 图-2:cmd

体系结构

FFmpeg-Android运行在以下架构上:

  • armeabi
  • armeabi-v7a
  • armv7-neon
  • arm64-v8a

FFmpeg构建

在本项目中,FFmpeg是通过以下库构建的:

  • x264 r2851 ba24899
  • libpng 1.6.21
  • freetype2 2.8.1
  • libmp3lame 3.100
  • libvorbis 1.3.5
  • libvpx v1.6.1-1456-g7d1bf5d
  • libopus 1.2.1
  • fontconfig 2.11.94
  • libass 0.14.0
  • fribidi 0.19.7
  • expat 2.1.0
  • fdk-aac 0.1.6

特性

  • 使用最新的FFmpeg发行版 n4.0-39-gda39990
  • 在ARM架构上使用本机CPU功能
  • 启用网络功能
  • 多线程

使用

开始

包括依赖

allprojects {

repositories {
	...
	maven { url 'https://www.jitpack.io' }
	}

}
dependencies {
     implementation 'com.github.yangfeng1994:FFmpeg-Android:v1.0.1'
}

检查是否支持FFmpeg

要检查设备上是否有FFmpeg,可以使用以下方法。

if (FFmpeg.getInstance(this).isSupported()) {
  // 支持ffmpeg
} else {
  // 不支持ffmpeg
}

这就是加载FFmpeg库所要做的全部工作。

运行 FFmpeg command

在这个示例代码中,我们将运行ffmpeg -version命令。

FFmpeg ffmpeg = FFmpeg.getInstance(context);
  // 要执行“ffmpeg -version”命令,只需传递“-version”即可
ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler() {

    @Override
    public void onStart() {}

    @Override
    public void onProgress(String message) {}

    @Override
    public void onFailure(String message) {}

    @Override
    public void onSuccess(String message) {}

    @Override
    public void onFinish() {}

});

停止(或退出)FFmpeg进程

如果你想停止运行中的ffmpeg, 只需在运行的FFtask上调用' .sendQuitSignal() '

FFmpeg ffmpeg = FFmpeg.getInstance(context);
FFtask ffTask = ffmpeg.execute( ... )

ffTask.sendQuitSignal();

注意:这将导致' onFailure '被调用,而不是' onSuccess ' ._

体验demo

点击下载

Special Thanks To

Licensing

MIT License Copyright (c) 2018 Bravobit Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

FFmpeg-Android 是基于ffmpeg 4.0编译运行在android平台的音视频的处理框架,可实现视频字幕添加、尺寸剪切、添加或去除水印、时长截取、转GIF动图、涂鸦、音频提取、拼接、质量压缩、加速减速、倒放、素描、色彩平衡、hue、lut、模糊、九宫格、添加贴纸、滤镜、分屏、图片合成视频等,音视频合成、分离、截取、拼接,混音、音视频解码等等音视频处理... expand collapse
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shanxsx/FFmpeg-Android.git
git@gitee.com:shanxsx/FFmpeg-Android.git
shanxsx
FFmpeg-Android
FFmpeg-Android
master

Search