Add examples about new API features into documentation

This commit is contained in:
Taner Sener 2021-03-04 00:31:47 +00:00
parent 9a2792a376
commit 647aedbf5c
3 changed files with 320 additions and 114 deletions

View File

@ -1,4 +1,4 @@
# FFmpegKit ![GitHub release](https://img.shields.io/badge/release-v4.4-blue.svg) ![Maven Central](https://img.shields.io/maven-central/v/com.arthenica/ffmpeg-kit-min) ![CocoaPods](https://img.shields.io/cocoapods/v/ffmpeg-kit-ios-min) [![Build Status](https://travis-ci.org/tanersener/ffmpeg-kit.svg?branch=master)](https://travis-ci.org/tanersener/ffmpeg-kit)
# FFmpegKit ![GitHub release](https://img.shields.io/badge/release-v4.4.LTS-blue.svg) ![Maven Central](https://img.shields.io/maven-central/v/com.arthenica/ffmpeg-kit-min) ![CocoaPods](https://img.shields.io/cocoapods/v/ffmpeg-kit-ios-min) [![Build Status](https://travis-ci.org/tanersener/ffmpeg-kit.svg?branch=master)](https://travis-ci.org/tanersener/ffmpeg-kit)
FFmpeg Kit for applications.
@ -24,41 +24,37 @@ FFmpeg Kit for applications.
- Licensed under `LGPL 3.0`, or `GPL v3.0` if GPL licensed libraries are enabled
#### 1.1 Android
### 2. Android
See [Android](https://github.com/tanersener/ffmpeg-kit/tree/development/android).
See [Android](https://github.com/tanersener/ffmpeg-kit/tree/development/android) to learn more about `FFmpegKit` for
`Android`.
#### 1.2 iOS, macOS, tvOS
### 3. iOS, macOS, tvOS
See [Apple](https://github.com/tanersener/ffmpeg-kit/tree/development/apple).
See [Apple](https://github.com/tanersener/ffmpeg-kit/tree/development/apple) to use `FFmpegKit` on `Apple` platforms
(`iOS`, `macOS`, `tvOS`).
### 4. Build Scripts
### 2. Build Scripts
Use `android.sh`, `ios.sh`, `macos.sh` and `tvos.sh` to build `FFmpegKit` for each platform.
All four scripts support additional options to enable external libraries or disable platform architectures.
All scripts support additional options to enable libraries and disable platform architectures.
Refer to [Android](https://github.com/tanersener/ffmpeg-kit/tree/development/android) page for `Android` devices and
[Apple](https://github.com/tanersener/ffmpeg-kit/tree/development/apple) page for `iOS`, `macOS`, `tvOS` devices to see
the prerequisites for each platform.
### 3. FFmpegKit Library
### 5. FFmpegKit Library
`FFmpegKit` is a wrapper library that allows you to easily run `FFmpeg`/`FFprobe` commands in applications. It
provides additional features on top of `FFmpeg` to enable platform specific resources, control how commands are executed and how the results are handled.
provides additional features on top of `FFmpeg` to enable platform specific resources, control how commands are
executed and how the results are handled.
`Android` library has a `Java` API and `Apple` libraries (`iOS`, `macOS`, `tvOS`) have an `Objective-C` API,
which are identical.
which are identical in terms of features and capabilities.
See [Android](https://github.com/tanersener/ffmpeg-kit/tree/development/android) page to learn how the `Java` API
can be used on `Android` devices and [Apple](https://github.com/tanersener/ffmpeg-kit/tree/development/apple) page to
learn more about `Objective-C` API for `iOS`, `macOS`, `tvOS` devices.
### 4. Binary Packages
### 6. Binary Packages
There are eight different `ffmpeg-kit` packages distributed on
[Github](https://github.com/tanersener/ffmpeg-kit/releases),
[Maven Central](https://search.maven.org) and [CocoaPods](https://cocoapods.org).
Below you can see which system libraries and external libraries are enabled in each of package.
Below you can see which system libraries and external libraries are enabled in each one of them.
Please remember that some parts of `FFmpeg` are licensed under the `GPL` and only `GPL` licensed `ffmpeg-kit` packages
include them.
@ -111,7 +107,7 @@ include them.
- `AVFoundation` is not available on `tvOS`, `VideoToolbox` is not available on `tvOS` LTS releases
### 5. Versions
### 7. Versions
`FFmpegKit` binaries generated use the same major and minor version numbers as the upstream `FFmpeg` project. The exact
version number is obtained using `git describe --tags`. `dev` part in `FFmpeg` version number indicates that `FFmpeg`
@ -122,7 +118,7 @@ source is cloned from the `FFmpeg` `master` branch.
| [4.4](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 |
| [4.4.LTS](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.4.LTS) | 4.4-dev-3015 | Mar 03, 2021 |
### 6. LTS Releases
### 8. LTS Releases
`FFmpegKit` binaries are published in two release variants: `Main Release` and `LTS Release`.
@ -147,12 +143,20 @@ This table shows the differences between two variants.
| tvOS SDK | 10.2 | 9.2 |
| tvOS Architectures | arm64<br/>x86-64<br/>arm64-simulator | arm64<br/>x86-64 |
### 7. License
### 9. Test Applications
You can see how `FFmpegKit` is used inside an application by running test applications created under
[FFmpegKit Test](https://github.com/tanersener/ffmpeg-kit-test) project.
All applications are identical and supports command execution, video encoding, accessing https urls, encoding audio,
burning subtitles, video stabilisation, pipe operations, concurrent command execution.
### 10. License
`FFmpegKit` is licensed under the `LGPL v3.0`. However, if source code is built using the optional `--enable-gpl` flag
or prebuilt binaries with `-gpl` postfix are used, then `FFmpegKit` is subject to the `GPL v3.0` license.
### 8. Patents
### 11. Patents
It is not clearly explained in their documentation, but it is believed that `FFmpeg`, `kvazaar`, `x264` and `x265`
include algorithms which are subject to software patents. If you live in a country where software algorithms are
@ -163,7 +167,7 @@ that you seek legal advice first. See [FFmpeg Patent Mini-FAQ](https://ffmpeg.or
distribute that library, then you are subject to pay MPEG LA licensing fees. Refer to
[OpenH264 FAQ](https://www.openh264.org/faq.html) page for the details.
### 9. Contributing
### 12. Contributing
Feel free to submit issues or pull requests.
@ -171,7 +175,7 @@ Please note that `main` includes only the latest released source code. Changes p
developed under the `development` branch. Therefore, if you want to create a pull request, please open it against
the `development`.
### 10. See Also
### 13. See Also
- [FFmpeg API Documentation](https://ffmpeg.org/doxygen/4.0/index.html)
- [FFmpeg Wiki](https://trac.ffmpeg.org/wiki/WikiStart)

View File

@ -1,11 +1,9 @@
# FFmpegKit for Android
### 1. Features
- Supports
- `API Level 16+`
- `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures
- `zlib` and `MediaCodec` system libraries
- Can handle Storage Access Framework (SAF) uris
- Supports `API Level 24+` on Main releases and `API Level 16+` on LTS releases
- Includes `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86` and `x86_64` architectures
- Can handle Storage Access Framework (SAF) Uris
- Camera access on [supported devices](https://developer.android.com/ndk/guides/stable_apis#camera)
- Builds shared native libraries (.so)
- Creates Android archive with .aar extension
@ -14,32 +12,38 @@
Run `android.sh` at project root directory to build `ffmpeg-kit` and `ffmpeg` shared libraries.
Please note that `FFmpegKit` project repository includes the source code of `FFmpegKit` only. `android.sh` needs
network connectivity and internet access to `github.com` in order to download the source code of `FFmpeg` and
external libraries enabled.
#### 2.1 Prerequisites
`android.sh` requires the following packages and tools.
`android.sh` requires the following tools and packages.
1. Install Android tools listed below.
- **Android SDK Build Tools**
- **Android NDK r21e** or later with LLDB and CMake
##### 2.1.1 Android Tools
- Android SDK Build Tools
- Android NDK r21e or later with LLDB and CMake
2. Use your package manager (apt, yum, dnf, brew, etc.) to install the following packages.
##### 2.1.2 Packages
```
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget autopoint meson ninja
```
Use your package manager (apt, yum, dnf, brew, etc.) to install the following packages.
3. Set `ANDROID_SDK_ROOT` and `ANDROID_NDK_ROOT` environment variables.
```
export ANDROID_SDK_ROOT=<Android SDK Path>
export ANDROID_NDK_ROOT=<Android NDK Path>
```
```
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget autopoint meson ninja
```
4. `android.sh` needs network connectivity and internet access to `github.com` in order to download the source code
of all libraries except `ffmpeg-kit`.
##### 2.1.3 Environment Variables
Set `ANDROID_SDK_ROOT` and `ANDROID_NDK_ROOT` environment variables before running `android.sh`.
```
export ANDROID_SDK_ROOT=<Android SDK Path>
export ANDROID_NDK_ROOT=<Android NDK Path>
```
#### 2.2 Options
Use `--enable-<library name>` flags to support additional external or system libraries and
Use `--enable-<library name>` flag to support additional external or system libraries and
`--disable-<architecture name>` to disable architectures you don't want to build.
```
@ -77,7 +81,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
}
```
2. Execute synchronous FFmpeg commands.
2. Execute synchronous `FFmpeg` commands.
```
import com.arthenica.ffmpegkit.FFmpegKit;
@ -85,16 +89,60 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
if (ReturnCode.isSuccess(session.getReturnCode())) {
// SUCCESS
} else if (ReturnCode.isCancel(session.getReturnCode())) {
// CANCEL
} else {
// FAILURE
Log.d(TAG, String.format("Command failed with state %s and rc %s.%s", session.getState(), session.getReturnCode(), session.getFailStackTrace()));
}
```
3. Execute asynchronous FFmpeg commands by providing session specific execute/log/session callbacks.
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
session created.
```
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
// Unique session id created for this execution
long sessionId = session.getSessionId();
// Command arguments as a single string
String command = session.getCommand();
// Command arguments
String[] arguments = session.getArguments();
// State of the execution. Shows whether it is still running or completed
SessionState state = session.getState();
// Return code for completed sessions. Will be null if session is still running or ends with a failure
ReturnCode returnCode = session.getReturnCode();
Date startTime = session.getStartTime();
Date endTime = session.getEndTime();
long duration = session.getDuration();
// Console output generated for this execution
String output = session.getOutput();
// The stack trace if FFmpegKit fails to run a command
String failStackTrace = session.getFailStackTrace();
// The list of logs generated for this execution
List<com.arthenica.ffmpegkit.Log> logs = session.getLogs();
// The list of statistics generated for this execution
List<Statistics> statistics = session.getStatistics();
```
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
```
FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", new ExecuteCallback() {
@ -127,7 +175,9 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
});
```
4. Execute synchronous FFprobe commands.
5. Execute `FFprobe` commands.
- Synchronous
```
FFprobeSession session = FFprobeKit.execute(ffprobeCommand);
@ -137,14 +187,28 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
}
```
5. Get session output.
- Asynchronous
```
Session session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
Log.d(TAG, session.getOutput());
FFprobeKit.executeAsync(ffprobeCommand, new ExecuteCallback() {
@Override
public void apply(Session session) {
CALLED WHEN SESSION IS EXECUTED
}
});
```
6. Stop ongoing FFmpeg operations.
6. Get media information for a file.
```
MediaInformationSession mediaInformation = FFprobeKit.getMediaInformation("<file path or uri>");
mediaInformation.getMediaInformation();
```
7. Stop ongoing `FFmpeg` operations.
- Stop all executions
```
@ -155,19 +219,20 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
FFmpegKit.cancel(sessionId);
```
7. Get media information for a file.
8. Convert Storage Access Framework (SAF) Uris into paths that can be read or written by `FFmpegKit`.
```
MediaInformationSession mediaInformation = FFprobeKit.getMediaInformation("<file path or uri>");
mediaInformation.getMediaInformation();
Uri safUri = intent.getData();
String videoPath = FFmpegKitConfig.getSafParameterForWrite(requireContext(), safUri);
FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 " + videoPath);
```
8. List previous FFmpeg sessions.
9. Get previous `FFmpeg` and `FFprobe` sessions from session history.
```
List<FFmpegSession> ffmpegSessions = FFmpegKit.listSessions();
for (int i = 0; i < ffmpegSessions.size(); i++) {
FFmpegSession session = ffmpegSessions.get(i);
List<Session> sessions = FFmpegKitConfig.getSessions();
for (int i = 0; i < sessions.size(); i++) {
Session session = sessions.get(i);
Log.d(TAG, String.format("Session %d = id:%d, startTime:%s, duration:%s, state:%s, returnCode:%s.",
i,
session.getSessionId(),
@ -178,7 +243,57 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
}
```
10. Enable global callbacks.
- Execute Callback, called when an async execution is ended
```
FFmpegKitConfig.enableExecuteCallback(new ExecuteCallback() {
@Override
public void apply(Session session) {
}
});
```
- Log Callback, called when a session generates logs
```
FFmpegKitConfig.enableLogCallback(new LogCallback() {
@Override
public void apply(final com.arthenica.ffmpegkit.Log log) {
...
}
});
```
- Statistics Callback, called when a session generates statistics
```
FFmpegKitConfig.enableStatisticsCallback(new StatisticsCallback() {
@Override
public void apply(final Statistics newStatistics) {
...
}
});
```
11. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
```
FFmpegKitConfig.ignoreSignal(Signal.SIGXCPU);
```
12. Register system fonts and custom font directories.
```
FFmpegKitConfig.setFontDirectoryList(context, Arrays.asList("/system/fonts", "<folder with fonts>"), Collections.EMPTY_MAP);
```
### 4. Test Application
You can see how `FFmpegKit` is used inside an application by running test applications developed under the
You can see how `FFmpegKit` is used inside an application by running `Android` test applications developed under the
[FFmpegKit Test](https://github.com/tanersener/ffmpeg-kit-test) project.

View File

@ -2,57 +2,46 @@
### 1. Features
#### 1.1 iOS
- Builds `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `arm64e`, `i386`, `x86_64`, `x86_64-mac-catalyst` and
- Supports `iOS SDK 12.1+` on Main releases and `iOS SDK 9.3+` on LTS releases
- Includes `armv7`, `armv7s`, `arm64`, `arm64-simulator`, `arm64e`, `i386`, `x86_64`, `x86_64-mac-catalyst` and
`arm64-mac-catalyst` architectures
- Supports `bzip2`, `iconv`, `libuuid`, `zlib` system libraries and `AudioToolbox`, `AVFoundation`, `VideoToolbox` system frameworks
- Objective-C API
- Camera access
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Supports `iOS SDK 9.3` or later
#### 1.2 macOS
- Builds `arm64` and `x86_64` architectures
- Supports `bzip2`, `iconv`, `libuuid`, `zlib` system libraries and `AudioToolbox`, `AVFoundation`, `CoreImage`,
`OpenCL`, `OpenGL`, `VideoToolbox` system frameworks
- Supports `macOS SDK 10.15+` on Main releases and `macOS SDK 10.11+` on LTS releases
- Includes `arm64` and `x86_64` architectures
- Objective-C API
- Camera access
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Supports `macOS SDK 10.11` or later
#### 1.3 tvOS
- Builds `arm64`, `arm64-simulator` and `x86_64` architectures
- Supports `bzip2`, `iconv`, `libuuid`, `zlib` system libraries and `AudioToolbox`, `VideoToolbox` system frameworks
- Supports `tvOS SDK 10.2+` on Main releases and `tvOS SDK 9.2+` on LTS releases
- Includes `arm64`, `arm64-simulator` and `x86_64` architectures
- Objective-C API
- `ARC` enabled library
- Built with `-fembed-bitcode` flag
- Creates static `frameworks`, static `xcframeworks` and static `universal (fat)` libraries (.a)
- Supports `tvOS SDK 9.2` or later
### 2. Building
Run `ios.sh`/`macos.sh`/`tvos.sh` at project root directory to build `ffmpeg-kit` and `ffmpeg` shared libraries for a
Run `ios.sh`/`macos.sh`/`tvos.sh` at project root directory to build `ffmpeg-kit` and `ffmpeg` static libraries for a
platform.
Optionally, use `apple.sh` to combine bundles created by these three scripts in a single bundle.
Please note that `FFmpegKit` project repository includes the source code of `FFmpegKit` only. `ios.sh`, `macos.sh` and
`tvos.sh` need network connectivity and internet access to `github.com` in order to download the source code of
`FFmpeg` and external libraries enabled.
#### 2.1 Prerequisites
`ios.sh`/`macos.sh`/`tvos.sh` requires the following packages and tools.
1. Use your package manager (brew, etc.) to install the following packages.
```
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget autopoint meson ninja
```
2. `ios.sh`/`macos.sh`/`tvos.sh` needs network connectivity and internet access to `github.com` in order to download
the source code of all libraries except `ffmpeg-kit`.
3. Install the tools necessary listed below in `2.1.x`.
`ios.sh`, `macos.sh` and `tvos.sh` require the following tools and packages.
##### 2.1.1 iOS
@ -72,14 +61,24 @@ Optionally, use `apple.sh` to combine bundles created by these three scripts in
- **tvOS SDK 9.2** or later
- **Command Line Tools**
##### 2.1.4 Packages
Use your package manager (brew, etc.) to install the following packages.
```
autoconf automake libtool pkg-config curl cmake gcc gperf texinfo yasm nasm bison autogen git wget autopoint meson ninja
```
#### 2.2 Options
Use `--enable-<library name>` flags to support additional external or system libraries and
Use `--enable-<library name>` flag to support additional external or system libraries and
`--disable-<architecture name>` to disable architectures you don't want to build.
```
./ios.sh --enable-fontconfig --disable-armv7
./macos.sh --enable-freetype --enable-macos-avfoundation --disable-arm64
./tv.sh --enable-dav1d --enable-libvpx --disable-arm64-simulator
```
@ -110,7 +109,7 @@ All libraries created can be found under the `prebuilt` directory.
#### 3.1 Objective API
1. add `FFmpegKit` dependency to your `Podfile` in `ffmpeg-kit-<platform>-<package name>` pattern. Use one of the
1. Add `FFmpegKit` dependency to your `Podfile` in `ffmpeg-kit-<platform>-<package name>` pattern. Use one of the
`FFmpegKit` package names given in the project [README](https://github.com/tanersener/ffmpeg-kit).
- iOS
@ -128,24 +127,68 @@ All libraries created can be found under the `prebuilt` directory.
pod 'ffmpeg-kit-tvos-full', '~> 4.4.LTS'
```
2. Execute synchronous FFmpeg commands.
2. Execute synchronous `FFmpeg` commands.
```
#include <ffmpegkit/FFmpegKit.h>
FFmpegSession* session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
ReturnCode* returnCode = [session getReturnCode];
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
ReturnCode *returnCode = [session getReturnCode];
if ([ReturnCode isSuccess:returnCode]) {
// SUCCESS
} else if ([ReturnCode isCancel:returnCode]) {
// CANCEL
} else {
// FAILURE
NSLog(@"Command failed with state %@ and rc %@.%@", [FFmpegKitConfig sessionStateToString:[session getState]], returnCode, [session getFailStackTrace]);
}
```
3. Execute asynchronous FFmpeg commands by providing session specific execute/log/session callbacks.
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
session created.
```
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
// Unique session id created for this execution
long sessionId = [session getSessionId];
// Command arguments as a single string
NSString *command = [session getCommand];
// Command arguments
NSArray *arguments = [session getArguments];
// State of the execution. Shows whether it is still running or completed
SessionState state = [session getState];
// Return code for completed sessions. Will be null if session is still running or ends with a failure
ReturnCode *returnCode = [session getReturnCode];
NSDate *startTime =[session getStartTime];
NSDate *endTime =[session getEndTime];
long duration =[session getDuration];
// Console output generated for this execution
NSString *output = [session getOutput];
// The stack trace if FFmpegKit fails to run a command
NSString *failStackTrace = [session getFailStackTrace];
// The list of logs generated for this execution
NSArray *logs = [session getLogs];
// The list of statistics generated for this execution
NSArray *statistics = [session getStatistics];
```
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
```
id<Session> session = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v mpeg4 file2.mp4" withExecuteCallback:^(id<Session> session){
@ -167,23 +210,36 @@ All libraries created can be found under the `prebuilt` directory.
}];
```
4. Execute synchronous FFprobe commands.
5. Execute `FFprobe` commands.
- Synchronous
```
FFprobeSession *session = [FFprobeKit execute:ffprobeCommand];
if ([ReturnCode isSuccess:[session getReturnCode]]) {
NSLog(@"Command failed. Please check output for the details.");
}
```
5. Get session output.
- Asynchronous
```
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
NSLog([session getOutput]);
[FFprobeKit executeAsync:ffmpegCommand withExecuteCallback:^(id<Session> session) {
CALLED WHEN SESSION IS EXECUTED
}];
```
6. Stop ongoing FFmpeg operations.
6. Get media information for a file.
```
MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:"<file path or uri>"];
MediaInformation *mediaInformation =[mediaInformation getMediaInformation];
```
7. Stop ongoing `FFmpeg` operations.
- Stop all executions
```
@ -194,19 +250,12 @@ All libraries created can be found under the `prebuilt` directory.
[FFmpegKit cancel:sessionId];
```
7. Get media information for a file.
8. Get previous `FFmpeg` and `FFprobe` sessions from session history.
```
MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:"<file path or uri>"];
MediaInformation *mediaInformation =[mediaInformation getMediaInformation];
```
8. List previous FFmpeg sessions.
```
NSArray* ffmpegSessions = [FFmpegKit listSessions];
for (int i = 0; i < [ffmpegSessions count]; i++) {
FFmpegSession* session = [ffmpegSessions objectAtIndex:i];
NSArray* sessions = [FFmpegKitConfig getSessions];
for (int i = 0; i < [sessions count]; i++) {
id<Session> session = [sessions objectAtIndex:i];
NSLog(@"Session %d = id: %ld, startTime: %@, duration: %ld, state:%@, returnCode:%@.\n",
i,
[session getSessionId],
@ -217,7 +266,45 @@ All libraries created can be found under the `prebuilt` directory.
}
```
9. Enable global callbacks.
- Execute Callback, called when an async execution is ended
```
[FFmpegKitConfig enableExecuteCallback:^(id<Session> session) {
...
}];
```
- Log Callback, called when a session generates logs
```
[FFmpegKitConfig enableLogCallback:^(Log *log) {
...
}];
```
- Statistics Callback, called when a session generates statistics
```
[FFmpegKitConfig enableStatisticsCallback:^(Statistics *statistics) {
...
}];
```
10. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
```
[FFmpegKitConfig ignoreSignal:SIGXCPU];
```
11. Register system fonts and custom font directories.
```
[FFmpegKitConfig setFontDirectoryList:<array of folders with fonts> with:nil];
```
### 4. Test Application
You can see how `FFmpegKit` is used inside an application by running test applications developed under the
[FFmpegKit Test](https://github.com/tanersener/ffmpeg-kit-test) project.
You can see how `FFmpegKit` is used inside an application by running `iOS`, `macOS` and `tvOS` test applications
developed under the [FFmpegKit Test](https://github.com/tanersener/ffmpeg-kit-test) project.