MCPcopy Index your code
hub / github.com/dotintent/videokit-ffmpeg-android

github.com/dotintent/videokit-ffmpeg-android @1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.0 ↗ · + Follow
113 symbols 320 edges 16 files 16 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Video processing library based on FFmpeg

Main purpose

Main purpose of this library is to allow developers to embed FFmpeg into their application with literally one line of code in gradle.build. Using native code in Java in general and in Android environment especially always related to some problems. Hopefully VideoKit will resolve some of them.

Setup

Basic setup just add following line of code to your gradle.build file:
compile 'com.infullmobile.android:videokit-release:1.0.1'
Also, if you haven't use inFullMobile public maven in your project before, don't forget to add following line to your repositories:
maven { url 'https://maven.infullmobile.com/public' }
That's pretty much all.

Example usage

Module sample is showing usage of VideoKit. Please note, that VideoKit is basically invoking FFmpeg main() with CLI arguments so you will use commands almost like you use standard FFmpeg on Linux or Windows or MacOS.
Well, let me show you some code:

        final VideoKit videoKit = new VideoKit();
        final Command command = videoKit.createCommand()
                .overwriteOutput()
                .addInputPath(path)
                .outputPath(path + POSTFIX)
                .addCustomCommand("-ss 1 -t 3")
                .copyVideoCodec()
                .experimentalFlag()
                .build();

Command is basically set of instructions for FFmpeg. Please note, that order in which you adding instructions in CommandBuilder is quite important. Sometimes, when you mess up order, FFmpeg will not recognize command and end up with error. After you've built a command you should execute it: either with execute() or you can pass it to AsyncCommandExecutor.
Please note, that:
command.execute();
will be executed on thread on which it was called, while:
new AsyncCommandExecutor(command, this).execute();
will be executed in background thread and you have to provide implementation of ProcessingListener to get result of processing either in onSuccess (you will get path to processed file here) or onFailure (you will get error code here).

Other functions

VideoKit is also providing logging mechanism for FFmpeg. You can set logging level by calling function:
videoKit.setLogLevel(level)
where level is enum which consists of:

NO_LOG
ERRORS_ONLY
FULL

Specific behavior of flags

As I already have mentioned: FFmpeg is quite sensible to the order of flags. To help out with that to user VideoKit have default behavior for particular flags, namely: input paths, output path and experimental flag.
The order in which VideoKit is laying those flags is following:

  1. Input paths are always going first (doesn't matter in which place of chain you have added particular path)
  2. Output path is always going at the end of command
  3. Experimental flag is always just before output path

Error codes

I've tried to make library as debuggable as it even possible, taking in account that we're working with native code. If you getting failures from VideoKit and log in not really helpfull try to look into docs folder in ffmpeg_return_codes file. In this file you not only have list of possible return codes with which FFMpeg can exit, but also file and number of line of code in which exit was called.
Version of FFmpeg is 2.8.4 and changed sources can be found over here:
Development Kit

License

FFmpeg is licensed under LGPL:
License
This software uses libraries from the FFmpeg project under the LGPLv2.1

Extension points exported contracts — how you extend this code

Command (Interface)
Created by Ilja Kosynkin on 29.07.16. Copyright by inFullMobile [3 implementers]
videokit/src/main/java/processing/ffmpeg/videokit/Command.java
Callback (Interface)
(no doc) [1 implementers]
sample/src/main/java/ffmpeg/videokit/sample/VideoListAdapter.java
CommandBuilder (Interface)
Created by Ilja Kosynkin on 19.07.16. Copyright by inFullMobile [2 implementers]
videokit/src/main/java/processing/ffmpeg/videokit/CommandBuilder.java
Callbacks (Interface)
(no doc) [1 implementers]
sample/src/main/java/ffmpeg/videokit/sample/VideoListViewHolder.java
ProcessingListener (Interface)
Created by Ilja Kosynkin on 06.07.2016. Copyright by inFullMobile [2 implementers]
videokit/src/main/java/processing/ffmpeg/videokit/ProcessingListener.java

Core symbols most depended-on inside this repo

execute
called by 14
videokit/src/main/java/processing/ffmpeg/videokit/Command.java
build
called by 14
videokit/src/main/java/processing/ffmpeg/videokit/CommandBuilder.java
getValue
called by 12
videokit/src/main/java/processing/ffmpeg/videokit/LogLevel.java
getPath
called by 3
videokit/src/main/java/processing/ffmpeg/videokit/VideoProcessingResult.java
inputPath
called by 3
videokit/src/main/java/processing/ffmpeg/videokit/CommandBuilder.java
outputPath
called by 3
videokit/src/main/java/processing/ffmpeg/videokit/CommandBuilder.java
process
called by 3
videokit/src/main/java/processing/ffmpeg/videokit/VideoKit.java
getCode
called by 2
videokit/src/main/java/processing/ffmpeg/videokit/VideoProcessingResult.java

Shape

Method 95
Class 12
Interface 5
Enum 1

Languages

Java100%

Modules by API surface

videokit/src/main/java/processing/ffmpeg/videokit/VideoCommandBuilder.java20 symbols
videokit/src/test/java/processing/ffmpeg/videokit/CommandBuilderTest.java19 symbols
videokit/src/main/java/processing/ffmpeg/videokit/CommandBuilder.java14 symbols
sample/src/main/java/ffmpeg/videokit/sample/VideoListAdapter.java9 symbols
sample/src/main/java/ffmpeg/videokit/sample/MainActivity.java8 symbols
sample/src/main/java/ffmpeg/videokit/sample/VideoListViewHolder.java6 symbols
videokit/src/main/java/processing/ffmpeg/videokit/VideoProcessingResult.java5 symbols
videokit/src/main/java/processing/ffmpeg/videokit/VideoKit.java5 symbols
videokit/src/main/java/processing/ffmpeg/videokit/VideoCommand.java5 symbols
sample/src/main/java/ffmpeg/videokit/sample/Model.java5 symbols
videokit/src/test/java/processing/ffmpeg/videokit/CommandTest.java4 symbols
videokit/src/main/java/processing/ffmpeg/videokit/AsyncCommandExecutor.java4 symbols

For agents

$ claude mcp add videokit-ffmpeg-android \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact