百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
F

FFmpegVideoRecorder

> 编程语言
开源

可自定义的 Android 视频录制库,可合并多个视频

99 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

可自定义的 Android 视频录制库,可合并多个视频

FFmpegVideoRecorder - Customizable Video Recording Library for Android

The library provides a way to record multiple videos using MediaRecorder and merge them together using FFmpeg Recorder from JavaCV. It is designed to allow maximum customization of the video encoding and recording.

It has built in activities for easy recording and previewing. But it also exposes basic components that can be used to customize your own UI and logic.

Features

General

  • Able to record multiple clips and combine them into one video
  • Camera preview image is scaled, cropped, and padded to exactly how it will be recorded
  • Can generate a thumbnail image for the video
  • Can set recording parameters such as:
    • video codec
    • video width
    • video height
    • video frame rate
    • video bitrate
    • video scaling
    • video image fit
    • video cropping
    • video padding
    • audio codec
    • audio bitrate
    • audio channel count
    • audio sampling rate
  • Can set interaction parameters such as:
    • min and max recording time
    • max file size
    • tap to focus duration
    • tap to focus size
  • Can set theme colors parameters

Components

All components are designed to be extensible and usable without all the other components. Some of the main components:

CameraController

Wrapper for camera library that abstracts away some of the complications about checking support for various features.

CameraPreviewView

SurfaceView that scales and crops the view so that it matches the desired resolution.

MediaClipsRecorder

Recorder that simplifies logic for recording multiple video clips.

VideoTransformerTask

Task that combines multiple video files and transforms the video frames into the desired resolution.

FFmpegRecorderActivity

Activity that allows the user to record videos in a way similar to instagram and snapchat

  • Dynamically customize the color of the actionbar and widgets
  • Enable / disable flash
  • Switch between front and back cameras
  • Instagram / Snapchat like recording by holding down a button

FFmpegPreviewActivity

Activity to preview the recorded video before selecting the video

Limitations

  • Video width must be a multiple of 2, so the recorded video might not be in the exact dimensions requested.

Demo

There is a demo activity that allows you to try different settings for recording videos.

Installation

Gradle

compile 'com.amosyuen.ffmpegvideorecorder:ffmpeg-video-recorder:2.0.3'

Maven


  com.amosyuen.ffmpegvideorecorder
  ffmpeg-video-recorder
  2.0.3
  pom

Ivy


  

Local Checkout

bash
git clone git://github.com/amosyuen/FFmpegVideoRecorder.git

Usage

For a working implementation, please have a look at the demo project

  1. For Android M and above, make sure you request the following permissions before starting the activity:

    • Manifest.permission.CAMERA
    • Manifest.permission.RECORD_AUDIO
    • Manifest.permission.WAKE_LOCK
    • Manifest.permission.WRITE_EXTERNAL_STORAGE
  2. Send an intent to start the activity with the desired parameters. The parameters are required:

…
  1. Override onActivityResult method and handle request code sent in step 3.
…

Known Issues

UnsatisfiedLinkError

This error means that the native libraries were not installed properly. One common problem is that Android doesn't support loading both 64-bit and 32-bit native libraries at the same time. Unfortunately the FFmpeg library used in this library only has 32-bit binaries. So if your app includes another dependency that has 64-bit libraries, this will make the app unable to load the video recorder. The only workaround is to exclude 64-bit native libraries. This can be done by adding these lines in your app gradle build file:

android {
    //...
    packagingOptions {
        exclude "lib/arm64-v8a/**"
        exclude "lib/x86_64/**"
    }
    //...
}

Credits

This library is based off of these sources:

  • https://github.com/sourab-sharma/TouchToRecord
  • https://github.com/bytedeco/sample-projects/tree/master/JavaCV-android-example

It uses https://github.com/bytedeco/javacv for combining and encoding videos.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Java

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言