From 5ad7a336ca570f1a0aa38a90967ebb1cef812c8d Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Sat, 1 Oct 2022 22:37:39 +0100 Subject: [PATCH] update documentation --- .github/ISSUE_TEMPLATE/bug_report.md | 10 +- .github/pull_request_template.md | 2 +- README.md | 97 +++++---- android/README.md | 2 +- apple/README.md | 6 +- docs/index.md | 97 +++++---- linux/README.md | 285 +++++++++++++++++++++++++++ 7 files changed, 409 insertions(+), 90 deletions(-) create mode 100644 linux/README.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 7430786..1648054 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -27,14 +27,14 @@ Post logs here or paste them to [Ghostbin](https://ghostbin.co) and insert the l **Environment** -- Platform: `Android`/`Flutter`/`iOS`/`macOS`/`ReactNative`/`tvOS` +- Platform: `Android`/`Flutter`/`iOS`/`Linux`/`macOS`/`ReactNative`/`tvOS` - Architecture: `arm-v7a`, `arm-v7a-neon`, `arm64-v8a`, `x86`, `x86_64`, `armv7`, `armv7s`, `arm64`, `arm64-mac-catalyst`, `arm64-simulator`, `arm64e`, `i386`, `x86-64`, `x86-64-mac-catalyst` -- Version: `v4.5`/`v4.5.LTS` +- Version: `v5.1`/`v5.1.LTS` - Source branch: `main`, `development` -- Xcode version: `12.4.1` -- Cocoapods version: `1.10.1` +- Xcode version: `13.4.1` +- Cocoapods version: `1.10.3` - Android Studio version: `4.0` -- Android NDK version: `r22b` +- Android NDK version: `r25b` - flutter doctor: ` ` - react-native info: ` ` diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8d9077e..fe16e58 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,7 +8,7 @@ Please also include the context and motivation about the changes introduced. - Documentation ## Checks -- [ ] Changes support all platforms (`Android`, `iOS`, `macOS`, `tvOS`) +- [ ] Changes support all platforms (`Android`, `iOS`, `Linux`, macOS`, `tvOS`) - [ ] Breaks existing functionality - [ ] Implementation is completed, not half-done - [ ] Is there another PR already created for this feature/bug fix diff --git a/README.md b/README.md index bfffa70..2cdc9b9 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# FFmpegKit ![GitHub release](https://img.shields.io/badge/release-v4.5.1-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) ![pub](https://img.shields.io/pub/v/ffmpeg_kit_flutter.svg) ![npm](https://img.shields.io/npm/v/ffmpeg-kit-react-native.svg) +# FFmpegKit ![GitHub release](https://img.shields.io/badge/release-v5.1-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) ![pub](https://img.shields.io/pub/v/ffmpeg_kit_flutter.svg) ![npm](https://img.shields.io/npm/v/ffmpeg-kit-react-native.svg) -`FFmpegKit` is a collection of tools to use `FFmpeg` in `Android`, `iOS`, `macOS`, `tvOS`, `Flutter` and `React Native` applications. +`FFmpegKit` is a collection of tools to use `FFmpeg` in `Android`, `iOS`, `Linux`, `macOS`, `tvOS`, `Flutter` and `React Native` applications. It includes scripts to build `FFmpeg` native libraries, a wrapper library to run `FFmpeg`/`FFprobe` commands in applications and 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), @@ -11,9 +11,9 @@ It includes scripts to build `FFmpeg` native libraries, a wrapper library to run ### 1. Features - Scripts to build FFmpeg native libraries - `FFmpegKit` wrapper library to run `FFmpeg`/`FFprobe` commands in applications -- Supports native platforms: Android, iOS, macOS and tvOS +- Supports native platforms: Android, iOS, Linux, macOS and tvOS - Supports hybrid platforms: Flutter, React Native -- Based on FFmpeg `v4.5-dev` with optional system and external libraries +- Based on FFmpeg `v4.5-dev` or later with optional system and external libraries - 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), [Maven Central](https://search.maven.org), [CocoaPods](https://cocoapods.org), [pub](https://pub.dev) and [npm](https://www.npmjs.com) - Licensed under `LGPL 3.0`, or `GPL v3.0` if GPL licensed libraries are enabled @@ -29,28 +29,32 @@ See [Apple](apple) to use `FFmpegKit` on `Apple` platforms (`iOS`, `macOS`, `tvO See [Flutter](flutter/flutter) to learn more about `FFmpegKit` for `Flutter`. -### 5. React Native +### 5. Linux + +See [Linux](linux) to learn more about `FFmpegKit` for `Linux`. + +### 6. React Native See [React Native](react-native) to learn more about `FFmpegKit` for `React Native`. -### 6. Build Scripts +### 7. Build Scripts -Use `android.sh`, `ios.sh`, `macos.sh` and `tvos.sh` to build `FFmpegKit` for each native platform. +Use `android.sh`, `ios.sh`, `linux.sh`, `macos.sh` and `tvos.sh` to build `FFmpegKit` for each native platform. All scripts support additional options to enable optional libraries and disable platform architectures. See [Building](https://github.com/arthenica/ffmpeg-kit/wiki/Building) wiki page for the details. -### 7. FFmpegKit Library +### 8. 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. `Android` library of `FFmpegKit` has a `Java` API, `Apple` libraries (`iOS`, `macOS`, `tvOS`) have an `Objective-C` - API, `Flutter`library comes with a `Dart` API and `React Native` library provides a `JavaScript` API, which are - identical in terms of features and capabilities. + API, `Flutter` library comes with a `Dart` API, `Linux` library has a `C++` API and `React Native` library provides +a `JavaScript` API with `Typescript` definitions, which are identical in terms of features and capabilities. -### 8. Packages +### 9. Packages There are eight different `ffmpeg-kit` packages distributed on [Github](https://github.com/arthenica/ffmpeg-kit/releases), @@ -111,26 +115,30 @@ include them. - `VideoToolbox` is not available on LTS releases of `iOS` and `tvOS` - `zimg` is supported since `v4.5.1` -### 9. Versions +### 10. Versions -`FFmpegKit` binaries generated use the same major and minor version numbers as the upstream `FFmpeg` project. +`FFmpegKit` binaries generated use the same major and minor version numbers as the upstream `FFmpeg` project. The +third and last number in the version string, if exists, is specific to `FFmpegKit`. It shows different releases from +the same `FFmpeg` release branch. -The exact version number of `FFmpeg` is obtained using `git describe --tags`. `dev` part in the version string -indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch. +`dev` part in the version string indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch and +the exact version number of `FFmpeg` is obtained using the `git describe --tags` command. | Platforms | FFmpegKit Version | FFmpeg Version | Release Date | -|:----------------:|:----------------------------------------------------------------------------------:| :------------: |:------------:| -| React Native | [4.5.2](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 | -| Flutter | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | -| React Native | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | -| Android | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 | -| Apple | [4.5.1](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Dec 30, 2021 | -| Flutter | [4.5.0](https://github.com/tanersener/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 | -| React Native | [4.5.0](https://github.com/tanersener/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 | -| Android
Apple | [4.5](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | -| Android
Apple | [4.4](https://github.com/tanersener/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 | +|:----------------:|:----------------------------------------------------------------------------------:|:--------------:|:------------:| +| Android | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 | +| Apple | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 | +| React Native | [4.5.2](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 | +| Flutter | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | +| React Native | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | +| Android | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 | +| Apple | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Dec 30, 2021 | +| Flutter | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 | +| React Native | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 | +| Android
Apple | [4.5](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | +| Android
Apple | [4.4](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 | -### 10. LTS Releases +### 11. LTS Releases `FFmpegKit` binaries are published in two release variants: `Main Release` and `LTS Release`. @@ -160,11 +168,11 @@ This table shows the differences between two variants. | tvOS Architectures | arm64
x86-64
arm64-simulator | arm64
x86-64 | | tvOS Bundle Format | XCFrameworks | Frameworks | -### 11. Documentation +### 12. Documentation A more detailed documentation is available under [Wiki](https://github.com/arthenica/ffmpeg-kit/wiki). -### 12. Test Applications +### 13. Test Applications You can see how `FFmpegKit` is used inside an application by running test applications created under [FFmpegKit Test](https://github.com/arthenica/ffmpeg-kit-test) project. @@ -172,14 +180,26 @@ You can see how `FFmpegKit` is used inside an application by running test applic All applications are identical and supports command execution, video encoding, accessing https urls, encoding audio, burning subtitles, video stabilisation, pipe operations and concurrent command execution. -### 13. License +### 14. 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. +`FFmpegKit` library alone is licensed under the `LGPL v3.0`. -See the [License](https://github.com/arthenica/ffmpeg-kit/wiki/License) wiki page for the details. +`FFmpegKit` bundles (`.aar` archives, `frameworks`, `xcframeworks`), which include both `FFmpegKit` and `FFmpeg` +libraries, are also licensed under the `LGPL v3.0`. However, if the source code is built using the optional +`--enable-gpl` flag or prebuilt binaries with `-gpl` postfix are used, then `FFmpegKit` bundles become subject to the +`GPL v3.0`. Because, `FFmpeg` is licensed under the `GPL v3.0` in those bundles. And that makes the whole bundle +effectively subject to the `GPL v3.0`. -### 14. Patents +`FFmpegKit` build scripts always configure `FFmpeg` with `--enable-version3` option. And never enable non-free +libraries. Thus, `FFmpeg` libraries created by `FFmpegKit` are licensed under the `LGPL v3.0` by default. Only when +`--enable-gpl` is provided they become subject to `GPL v3.0`. That is how prebuilt binaries with `-gpl` postfix are +compiled. + +Refer to [Licenses](https://github.com/arthenica/ffmpeg-kit/wiki/Licenses) to see the licenses of all libraries. +[Trademark](https://github.com/arthenica/ffmpeg-kit/wiki/Trademark) lists the trademarks used in the `FFmpegKit` +documentation. + +### 15. 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 @@ -190,16 +210,11 @@ 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. -### 15. Contributing +### 16. Contributing -Feel free to submit issues or pull requests. +See our [CONTRIBUTING](CONTRIBUTING.md) guide. -Please note that `main` includes only the latest released source code. Changes planned for the next release are -developed under the `development` branches (`development` for native platforms, `development-react-native` for -`react-native`, `development-flutter` for `flutter`). Therefore, if you want to create a pull request, please open it - against them. - -### 16. See Also +### 17. See Also - [FFmpeg API Documentation](https://ffmpeg.org/doxygen/4.0/index.html) - [FFmpeg Wiki](https://trac.ffmpeg.org/wiki/WikiStart) diff --git a/android/README.md b/android/README.md index 78e664a..40db041 100644 --- a/android/README.md +++ b/android/README.md @@ -77,7 +77,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director } dependencies { - implementation 'com.arthenica:ffmpeg-kit-full:4.5.1-1' + implementation 'com.arthenica:ffmpeg-kit-full:5.1' } ``` diff --git a/apple/README.md b/apple/README.md index ef281a1..f6c6ec3 100644 --- a/apple/README.md +++ b/apple/README.md @@ -111,17 +111,17 @@ All libraries created can be found under the `prebuilt` directory. - iOS ```yaml - pod 'ffmpeg-kit-ios-full', '~> 4.5.1' + pod 'ffmpeg-kit-ios-full', '~> 5.1' ``` - macOS ```yaml - pod 'ffmpeg-kit-macos-full', '~> 4.5.1' + pod 'ffmpeg-kit-macos-full', '~> 5.1' ``` - tvOS ```yaml - pod 'ffmpeg-kit-tvos-full', '~> 4.5.1' + pod 'ffmpeg-kit-tvos-full', '~> 5.1' ``` 2. Execute synchronous `FFmpeg` commands. diff --git a/docs/index.md b/docs/index.md index 8ef6494..12d8eed 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ -`FFmpegKit` is a collection of tools to use `FFmpeg` in `Android`, `iOS`, `macOS`, `tvOS`, `Flutter` and `React Native` applications. +`FFmpegKit` is a collection of tools to use `FFmpeg` in `Android`, `iOS`, `Linux`, `macOS`, `tvOS`, `Flutter` and `React Native` applications. It includes scripts to build `FFmpeg` native libraries, a wrapper library to run `FFmpeg`/`FFprobe` commands in applications and 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), @@ -11,9 +11,9 @@ applications and 8 prebuilt binary packages available at [Github](https://github ### 1. Features - Scripts to build FFmpeg native libraries - `FFmpegKit` wrapper library to run `FFmpeg`/`FFprobe` commands in applications -- Supports native platforms: Android, iOS, macOS and tvOS +- Supports native platforms: Android, iOS, Linux, macOS and tvOS - Supports hybrid platforms: Flutter, React Native -- Based on FFmpeg `v4.5-dev` with optional system and external libraries +- Based on FFmpeg `v4.5-dev` or later with optional system and external libraries - 8 prebuilt binary packages available at [Github](https://github.com/arthenica/ffmpeg-kit/releases), [Maven Central](https://search.maven.org), [CocoaPods](https://cocoapods.org), [pub](https://pub.dev) and [npm](https://www.npmjs.com) - Licensed under `LGPL 3.0`, or `GPL v3.0` if GPL licensed libraries are enabled @@ -32,29 +32,34 @@ See [Apple](https://github.com/arthenica/ffmpeg-kit/tree/development/apple) to u See [Flutter](https://github.com/arthenica/ffmpeg-kit/tree/main/flutter/flutter) to learn more about `FFmpegKit` for `Flutter`. -### 5. React Native +### 5. Linux + +See [Linux](https://github.com/arthenica/ffmpeg-kit/tree/main/linux) to learn more about `FFmpegKit` for +`Linux`. + +### 6. React Native See [React Native](https://github.com/arthenica/ffmpeg-kit/tree/main/react-native) to learn more about `FFmpegKit` for `React Native`. -### 6. Build Scripts +### 7. Build Scripts -Use `android.sh`, `ios.sh`, `macos.sh` and `tvos.sh` to build `FFmpegKit` for each native platform. +Use `android.sh`, `ios.sh`, `linux.sh`, `macos.sh` and `tvos.sh` to build `FFmpegKit` for each native platform. All scripts support additional options to enable optional libraries and disable platform architectures. See [Building](https://github.com/arthenica/ffmpeg-kit/wiki/Building) wiki page for the details. -### 7. FFmpegKit Library +### 8. 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. `Android` library of `FFmpegKit` has a `Java` API, `Apple` libraries (`iOS`, `macOS`, `tvOS`) have an `Objective-C` -API, `Flutter`library comes with a `Dart` API and `React Native` library provides a `JavaScript` API, which are -identical in terms of features and capabilities. +API, `Flutter` library comes with a `Dart` API, `Linux` library has a `C++` API and `React Native` library provides +a `JavaScript` API with `Typescript` definitions, which are identical in terms of features and capabilities. -### 8. Packages +### 9. Packages There are eight different `ffmpeg-kit` packages distributed on [Github](https://github.com/arthenica/ffmpeg-kit/releases), @@ -98,25 +103,30 @@ include them. - `VideoToolbox` is not available on LTS releases of `iOS` and `tvOS` - `zimg` is supported since `v4.5.1` -### 8. Versions +### 10. Versions -`FFmpegKit` binaries generated use the same major and minor version numbers as the upstream `FFmpeg` project. +`FFmpegKit` binaries generated use the same major and minor version numbers as the upstream `FFmpeg` project. The +third and last number in the version string, if exists, is specific to `FFmpegKit`. It shows different releases from +the same `FFmpeg` release branch. -The exact version number of `FFmpeg` is obtained using `git describe --tags`. `dev` part in the version string -indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch. +`dev` part in the version string indicates that `FFmpeg` source code is cloned from the `FFmpeg` `master` branch and +the exact version number of `FFmpeg` is obtained using the `git describe --tags` command. -| Platforms | FFmpegKit Version | FFmpeg Version | Release Date | -|:----------------:|:--------------------------------------------------------------------------------------------:| :------------: |:------------:| -| Flutter | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | -| React Native | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | -| Android | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 | -| Apple | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Dec 30, 2021 | -| Flutter | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 | -| React Native | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 | -| Android
Apple | [4.5](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | -| Android
Apple | [4.4](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 | +| Platforms | FFmpegKit Version | FFmpeg Version | Release Date | +|:----------------:|:----------------------------------------------------------------------------------:|:--------------:|:------------:| +| Android | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 | +| Apple | [5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v5.1) | 5.1.2 | Sep 29, 2022 | +| React Native | [4.5.2](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.2) | 4.5-dev-3393 | May 25, 2022 | +| Flutter | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | +| React Native | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.1) | 4.5-dev-3393 | Jan 02, 2022 | +| Android | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Jan 01, 2022 | +| Apple | [4.5.1](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5.1) | 4.5-dev-3393 | Dec 30, 2021 | +| Flutter | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/flutter.v4.5.0) | 4.5-dev-2008 | Oct 05, 2021 | +| React Native | [4.5.0](https://github.com/arthenica/ffmpeg-kit/releases/tag/react.native.v4.5.0) | 4.5-dev-2008 | Oct 01, 2021 | +| Android
Apple | [4.5](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.5) | 4.5-dev-2008 | Sep 18, 2021 | +| Android
Apple | [4.4](https://github.com/arthenica/ffmpeg-kit/releases/tag/v4.4) | 4.4-dev-3015 | Mar 03, 2021 | -### 10. LTS Releases +### 11. LTS Releases `FFmpegKit` binaries are published in two release variants: `Main Release` and `LTS Release`. @@ -146,11 +156,11 @@ This table shows the differences between two variants. | tvOS Architectures | arm64
x86-64
arm64-simulator | arm64
x86-64 | | tvOS Bundle Format | XCFrameworks | Frameworks | -### 11. Documentation +### 12. Documentation A more detailed documentation is available under [Wiki](https://github.com/arthenica/ffmpeg-kit/wiki). -### 12. Test Applications +### 13. Test Applications You can see how `FFmpegKit` is used inside an application by running test applications created under [FFmpegKit Test](https://github.com/arthenica/ffmpeg-kit-test) project. @@ -158,12 +168,26 @@ You can see how `FFmpegKit` is used inside an application by running test applic All applications are identical and supports command execution, video encoding, accessing https urls, encoding audio, burning subtitles, video stabilisation, pipe operations and concurrent command execution. -### 13. License +### 14. 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. +`FFmpegKit` library alone is licensed under the `LGPL v3.0`. -### 14. Patents +`FFmpegKit` bundles (`.aar` archives, `frameworks`, `xcframeworks`), which include both `FFmpegKit` and `FFmpeg` +libraries, are also licensed under the `LGPL v3.0`. However, if the source code is built using the optional +`--enable-gpl` flag or prebuilt binaries with `-gpl` postfix are used, then `FFmpegKit` bundles become subject to the +`GPL v3.0`. Because, `FFmpeg` is licensed under the `GPL v3.0` in those bundles. And that makes the whole bundle +effectively subject to the `GPL v3.0`. + +`FFmpegKit` build scripts always configure `FFmpeg` with `--enable-version3` option. And never enable non-free +libraries. Thus, `FFmpeg` libraries created by `FFmpegKit` are licensed under the `LGPL v3.0` by default. Only when +`--enable-gpl` is provided they become subject to `GPL v3.0`. That is how prebuilt binaries with `-gpl` postfix are +compiled. + +Refer to [Licenses](https://github.com/arthenica/ffmpeg-kit/wiki/Licenses) to see the licenses of all libraries. +[Trademark](https://github.com/arthenica/ffmpeg-kit/wiki/Trademark) lists the trademarks used in the `FFmpegKit` +documentation. + +### 15. 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 @@ -174,16 +198,11 @@ 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. -### 15. Contributing +### 16. Contributing -Feel free to submit issues or pull requests. +See our [CONTRIBUTING](https://github.com/arthenica/ffmpeg-kit/blob/main/CONTRIBUTING.md) guide. -Please note that `main` includes only the latest released source code. Changes planned for the next release are -developed under the `development` branches (`development` for native platforms, `development-react-native` for -`react-native`, `development-flutter` for `flutter`). Therefore, if you want to create a pull request, please open it -against them. - -### 16. See Also +### 17. See Also - [FFmpeg API Documentation](https://ffmpeg.org/doxygen/4.0/index.html) - [FFmpeg Wiki](https://trac.ffmpeg.org/wiki/WikiStart) diff --git a/linux/README.md b/linux/README.md new file mode 100644 index 0000000..78494f5 --- /dev/null +++ b/linux/README.md @@ -0,0 +1,285 @@ +# FFmpegKit for Linux + +### 1. Features +- Provides a `C++` API with `c++11` +- Includes `x86_64` architecture +- Builds shared native libraries (.so) +- Prebuilt binaries not published + +### 2. Building + +Run `linux.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. `linux.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 + +`linux.sh` requires the following packages. + +##### 2.1.1 Packages + +Use your package manager (apt, yum, dnf, etc.) to install the following packages. + +Note that the names of the Linux packages vary from distribution to distribution. The names given below are +valid for Debian/Ubuntu. Some packages may have a different name if you are on another distribution. + +- The following packages are required by the build scripts. + + ``` + clang llvm lld libclang-11-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev + ``` + +- These optional packages should be installed only if you want to build corresponding external libraries. + + ``` + cmake libasound2-dev libass-dev libfontconfig1-dev libfreetype-dev libfribidi-dev libgmp-dev libgnutls28-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libopus-dev librubberband-dev libsdl2-dev libshine-dev libsnappy-dev libsoxr-dev libspeex-dev libtesseract-dev libtheora-dev libtwolame-dev libva-dev libvidstab-dev libvorbis-dev libvo-amrwbenc-dev libvpx-dev libv4l-dev libwebp-dev libxml2-dev libxvidcore-dev libx265-dev meson ocl-icd-opencl-dev opencl-headers tcl zlib1g-dev + ``` + +#### 2.2 Options + +Use `--enable-` flag to support additional external or system libraries. + +``` +./linux.sh --enable-fontconfig +``` + +Run `--help` to see all available build options. + +#### 2.3 Build Output + +All libraries created by `linux.sh` can be found under the `prebuilt` directory. + +- Headers and libraries created for the `Main` builds are located under the `bundle-linux` folder. + +### 3. Using + +#### 3.1 C++ API + +`FFmpegKit` doesn't publish any prebuilt `Linux` libraries, as it does for other platforms. Therefore, you need to +manually build and import `FFmpegKit` libraries into your projects. + +Then, you can use the following API methods to execute `FFmpeg` and `FFprobe` commands inside your application. + +1. Execute synchronous `FFmpeg` commands. + + ```C++ + #include + #include + + using namespace ffmpegkit; + + auto 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 + std::cout << "Command failed with state " << FFmpegKitConfig::sessionStateToString(session->getState()) << " and rc " << session->getReturnCode() << "." << session->getFailStackTrace() << std::endl; + + } + ``` + +2. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the + session created. + + ```C++ + #include + #include + + using namespace ffmpegkit; + + auto 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 + auto command = session->getCommand(); + + // Command arguments + auto 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 + auto returnCode = session->getReturnCode(); + + auto startTime = session->getStartTime(); + auto endTime = session->getEndTime(); + long duration = session->getDuration(); + + // Console output generated for this execution + auto output = session->getOutput(); + + // The stack trace if FFmpegKit fails to run a command + auto failStackTrace = session->getFailStackTrace(); + + // The list of logs generated for this execution + auto logs = session->getLogs(); + + // The list of statistics generated for this execution + auto statistics = session->getStatistics(); + ``` + +3. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks. + + ```C++ + #include + #include + + using namespace ffmpegkit; + + FFmpegKit::executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", [](auto session) { + const auto state = session->getState(); + auto returnCode = session->getReturnCode(); + + // CALLED WHEN SESSION IS EXECUTED + + std::cout << "FFmpeg process exited with state " << FFmpegKitConfig::sessionStateToString(state) << " and rc " << returnCode << "." << session->getFailStackTrace() << std::endl; + }, [](auto log) { + + // CALLED WHEN SESSION PRINTS LOGS + + }, [](auto statistics) { + + // CALLED WHEN SESSION GENERATES STATISTICS + + }); + ``` + +4. Execute `FFprobe` commands. + + - Synchronous + + ```C++ + #include + #include + + using namespace ffmpegkit; + + auto session = FFprobeKit::execute(ffprobeCommand); + + if (!ReturnCode::isSuccess(session->getReturnCode())) { + std::cout << "Command failed. Please check output for the details." << std::endl; + } + ``` + + - Asynchronous + + ```C++ + #include + #include + + using namespace ffmpegkit; + + FFprobeKit::executeAsync(ffprobeCommand, [](auto session) { + + // CALLED WHEN SESSION IS EXECUTED + + }); + ``` + +5. Get media information for a file. + + ```C++ + #include + + using namespace ffmpegkit; + + auto mediaInformation = FFprobeKit::getMediaInformation(""); + mediaInformation->getMediaInformation(); + ``` + +6. Stop ongoing `FFmpeg` operations. + + - Stop all executions + ```C++ + FFmpegKit::cancel(); + ``` + - Stop a specific session + ```C++ + FFmpegKit::cancel(sessionId); + ``` + +7. Get previous `FFmpeg` and `FFprobe` sessions from session history. + + ```C++ + #include + + using namespace ffmpegkit; + + auto sessions = FFmpegKitConfig::getSessions(); + int i = 0; + std::for_each(sessions->begin(), sessions->end(), [](const auto session) { + std::cout << "Session " << i++ << " = id:" << session->getSessionId() << ", startTime:" << session->getStartTime() << ", duration:" << session-> getDuration() << ", state:" << FFmpegKitConfig::sessionStateToString(session->getState()) << ", returnCode:" << session->getReturnCode() << "." << std::endl; + }); + ``` +8. Enable global callbacks. + + - Session type specific Complete Callbacks, called when an async session has been completed + + ```C++ + #include + + using namespace ffmpegkit; + + FFmpegKitConfig::enableFFmpegSessionCompleteCallback([](auto session) { + + }); + + FFmpegKitConfig::enableFFprobeSessionCompleteCallback([](auto session) { + + }); + + FFmpegKitConfig::enableMediaInformationSessionCompleteCallback([](auto session) { + + }); + ``` + + - Log Callback, called when a session generates logs + + ```C++ + #include + + using namespace ffmpegkit; + + FFmpegKitConfig::enableLogCallback([](auto log) { + ... + }); + ``` + + - Statistics Callback, called when a session generates statistics + + ```C++ + #include + + using namespace ffmpegkit; + + FFmpegKitConfig::enableStatisticsCallback([](auto statistics) { + ... + }); + ``` + +9. Register system fonts and custom font directories. + + ```C++ + #include + + using namespace ffmpegkit; + + FFmpegKitConfig::setFontDirectoryList(std::list{"/usr/share/fonts"}, std::map())); + ``` + +### 4. Test Application + +You can see how `FFmpegKit` is used inside an application by running `Linux` test applications developed under the +[FFmpegKit Test](https://github.com/arthenica/ffmpeg-kit-test) project.