commit
21eaa9a729
|
@ -71,7 +71,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
`ffmpeg-kit-<package name>` pattern. Use one of the `FFmpegKit` package names given in the
|
||||
project [README](https://github.com/tanersener/ffmpeg-kit).
|
||||
|
||||
```
|
||||
```yaml
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
@ -83,9 +83,8 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
2. Execute synchronous `FFmpeg` commands.
|
||||
|
||||
```
|
||||
```java
|
||||
import com.arthenica.ffmpegkit.FFmpegKit;
|
||||
import com.arthenica.ffmpegkit.ReturnCode;
|
||||
|
||||
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
|
||||
if (ReturnCode.isSuccess(session.getReturnCode())) {
|
||||
|
@ -107,7 +106,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
|
||||
session created.
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegSession session = FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 file2.mp4");
|
||||
|
||||
// Unique session id created for this execution
|
||||
|
@ -144,7 +143,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKit.executeAsync("-i file1.mp4 -c:v mpeg4 file2.mp4", new ExecuteCallback() {
|
||||
|
||||
@Override
|
||||
|
@ -179,7 +178,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Synchronous
|
||||
|
||||
```
|
||||
```java
|
||||
FFprobeSession session = FFprobeKit.execute(ffprobeCommand);
|
||||
|
||||
if (!ReturnCode.isSuccess(session.getReturnCode())) {
|
||||
|
@ -189,7 +188,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Asynchronous
|
||||
|
||||
```
|
||||
```java
|
||||
FFprobeKit.executeAsync(ffprobeCommand, new ExecuteCallback() {
|
||||
|
||||
@Override
|
||||
|
@ -203,7 +202,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
6. Get media information for a file.
|
||||
|
||||
```
|
||||
```java
|
||||
MediaInformationSession mediaInformation = FFprobeKit.getMediaInformation("<file path or uri>");
|
||||
mediaInformation.getMediaInformation();
|
||||
```
|
||||
|
@ -211,18 +210,18 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
7. Stop ongoing `FFmpeg` operations.
|
||||
|
||||
- Stop all executions
|
||||
```
|
||||
```java
|
||||
FFmpegKit.cancel();
|
||||
```
|
||||
- Stop a specific session
|
||||
```
|
||||
```java
|
||||
FFmpegKit.cancel(sessionId);
|
||||
```
|
||||
|
||||
8. Convert Storage Access Framework (SAF) Uris into paths that can be read or written by `FFmpegKit`.
|
||||
- Reading a file:
|
||||
|
||||
```
|
||||
```java
|
||||
Uri safUri = intent.getData();
|
||||
String inputVideoPath = FFmpegKitConfig.getSafParameterForRead(requireContext(), safUri);
|
||||
FFmpegKit.execute("-i " + inputVideoPath + " -c:v mpeg4 file2.mp4");
|
||||
|
@ -230,7 +229,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Writing to a file:
|
||||
|
||||
```
|
||||
```java
|
||||
Uri safUri = intent.getData();
|
||||
String outputVideoPath = FFmpegKitConfig.getSafParameterForWrite(requireContext(), safUri);
|
||||
FFmpegKit.execute("-i file1.mp4 -c:v mpeg4 " + outputVideoPath);
|
||||
|
@ -238,7 +237,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
9. Get previous `FFmpeg` and `FFprobe` sessions from session history.
|
||||
|
||||
```
|
||||
```java
|
||||
List<Session> sessions = FFmpegKitConfig.getSessions();
|
||||
for (int i = 0; i < sessions.size(); i++) {
|
||||
Session session = sessions.get(i);
|
||||
|
@ -256,7 +255,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Execute Callback, called when an async execution is ended
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKitConfig.enableExecuteCallback(new ExecuteCallback() {
|
||||
|
||||
@Override
|
||||
|
@ -268,7 +267,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Log Callback, called when a session generates logs
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKitConfig.enableLogCallback(new LogCallback() {
|
||||
|
||||
@Override
|
||||
|
@ -280,7 +279,7 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
- Statistics Callback, called when a session generates statistics
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKitConfig.enableStatisticsCallback(new StatisticsCallback() {
|
||||
|
||||
@Override
|
||||
|
@ -292,13 +291,13 @@ All libraries created by `android.sh` can be found under the `prebuilt` director
|
|||
|
||||
11. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKitConfig.ignoreSignal(Signal.SIGXCPU);
|
||||
```
|
||||
|
||||
12. Register system fonts and custom font directories.
|
||||
|
||||
```
|
||||
```java
|
||||
FFmpegKitConfig.setFontDirectoryList(context, Arrays.asList("/system/fonts", "<folder with fonts>"), Collections.EMPTY_MAP);
|
||||
```
|
||||
|
||||
|
|
|
@ -113,23 +113,23 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
`FFmpegKit` package names given in the project [README](https://github.com/tanersener/ffmpeg-kit).
|
||||
|
||||
- iOS
|
||||
```
|
||||
```yaml
|
||||
pod 'ffmpeg-kit-ios-full', '~> 4.5'
|
||||
```
|
||||
|
||||
- macOS
|
||||
```
|
||||
```yaml
|
||||
pod 'ffmpeg-kit-macos-full', '~> 4.5'
|
||||
```
|
||||
|
||||
- tvOS
|
||||
```
|
||||
```yaml
|
||||
pod 'ffmpeg-kit-tvos-full', '~> 4.5'
|
||||
```
|
||||
|
||||
2. Execute synchronous `FFmpeg` commands.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
#include <ffmpegkit/FFmpegKit.h>
|
||||
|
||||
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
|
||||
|
@ -153,7 +153,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
3. Each `execute` call (sync or async) creates a new session. Access every detail about your execution from the
|
||||
session created.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
FFmpegSession *session = [FFmpegKit execute:@"-i file1.mp4 -c:v mpeg4 file2.mp4"];
|
||||
|
||||
// Unique session id created for this execution
|
||||
|
@ -190,7 +190,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
4. Execute asynchronous `FFmpeg` commands by providing session specific `execute`/`log`/`session` callbacks.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
id<Session> session = [FFmpegKit executeAsync:@"-i file1.mp4 -c:v mpeg4 file2.mp4" withExecuteCallback:^(id<Session> session){
|
||||
SessionState state = [session getState];
|
||||
ReturnCode *returnCode = [session getReturnCode];
|
||||
|
@ -214,7 +214,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
- Synchronous
|
||||
|
||||
```
|
||||
```objectivec
|
||||
FFprobeSession *session = [FFprobeKit execute:ffprobeCommand];
|
||||
|
||||
if ([ReturnCode isSuccess:[session getReturnCode]]) {
|
||||
|
@ -224,7 +224,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
- Asynchronous
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFprobeKit executeAsync:ffmpegCommand withExecuteCallback:^(id<Session> session) {
|
||||
|
||||
CALLED WHEN SESSION IS EXECUTED
|
||||
|
@ -234,7 +234,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
6. Get media information for a file.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:"<file path or uri>"];
|
||||
MediaInformation *mediaInformation =[mediaInformation getMediaInformation];
|
||||
```
|
||||
|
@ -242,17 +242,17 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
7. Stop ongoing `FFmpeg` operations.
|
||||
|
||||
- Stop all executions
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKit cancel];
|
||||
```
|
||||
- Stop a specific session
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKit cancel:sessionId];
|
||||
```
|
||||
|
||||
8. Get previous `FFmpeg` and `FFprobe` sessions from session history.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
NSArray* sessions = [FFmpegKitConfig getSessions];
|
||||
for (int i = 0; i < [sessions count]; i++) {
|
||||
id<Session> session = [sessions objectAtIndex:i];
|
||||
|
@ -270,7 +270,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
- Execute Callback, called when an async execution is ended
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKitConfig enableExecuteCallback:^(id<Session> session) {
|
||||
...
|
||||
}];
|
||||
|
@ -278,7 +278,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
- Log Callback, called when a session generates logs
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKitConfig enableLogCallback:^(Log *log) {
|
||||
...
|
||||
}];
|
||||
|
@ -286,7 +286,7 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
- Statistics Callback, called when a session generates statistics
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKitConfig enableStatisticsCallback:^(Statistics *statistics) {
|
||||
...
|
||||
}];
|
||||
|
@ -294,13 +294,13 @@ All libraries created can be found under the `prebuilt` directory.
|
|||
|
||||
10. Ignore the handling of a signal. Required by `Mono` and frameworks that use `Mono`, e.g. `Unity` and `Xamarin`.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKitConfig ignoreSignal:SIGXCPU];
|
||||
```
|
||||
|
||||
11. Register system fonts and custom font directories.
|
||||
|
||||
```
|
||||
```objectivec
|
||||
[FFmpegKitConfig setFontDirectoryList:[NSArray arrayWithObjects:@"/System/Library/Fonts", @"<folder with fonts>", nil] with:nil];
|
||||
```
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
|
|||
case ${ARCH_NAME} in
|
||||
armv7 | armv7s | i386)
|
||||
|
||||
# SUPPORTED UNTIL IOS SDK 10
|
||||
if [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then
|
||||
# SUPPORTED UNTIL IOS SDK 10.3.1
|
||||
if [[ $(echo "$2 > 10.4" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=0
|
||||
else
|
||||
local SUPPORTED=1
|
||||
|
@ -39,8 +39,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
|
|||
;;
|
||||
arm64e)
|
||||
|
||||
# INTRODUCED IN IOS SDK 10
|
||||
if [[ $2 == 10* ]] || [[ $2 == 11* ]] || [[ $2 == 12* ]] || [[ $2 == 13* ]] || [[ $2 == 14* ]]; then
|
||||
# INTRODUCED IN IOS SDK 10.1
|
||||
if [[ $(echo "$2 > 10" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=1
|
||||
else
|
||||
local SUPPORTED=0
|
||||
|
@ -49,7 +49,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
|
|||
x86-64-mac-catalyst)
|
||||
|
||||
# INTRODUCED IN IOS SDK 13
|
||||
if [[ $2 == 13* ]] || [[ $2 == 14* ]]; then
|
||||
if [[ $(echo "$2 > 12.4" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=1
|
||||
else
|
||||
local SUPPORTED=0
|
||||
|
@ -58,7 +58,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
|
|||
arm64-*)
|
||||
|
||||
# INTRODUCED IN IOS SDK 14
|
||||
if [[ $2 == 14* ]]; then
|
||||
if [[ $(echo "$2 > 13.7" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=1
|
||||
else
|
||||
local SUPPORTED=0
|
||||
|
@ -88,7 +88,7 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
|
|||
arm64-simulator)
|
||||
|
||||
# INTRODUCED IN TVOS SDK 14
|
||||
if [[ $2 == 14* ]]; then
|
||||
if [[ $(echo "$2 > 13.4" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=1
|
||||
else
|
||||
local SUPPORTED=0
|
||||
|
@ -118,7 +118,7 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() {
|
|||
arm64)
|
||||
|
||||
# INTRODUCED IN MACOS SDK 11
|
||||
if [[ $2 == 11* ]]; then
|
||||
if [[ $(echo "$2 > 10.16" | bc) -eq 1 ]]; then
|
||||
local SUPPORTED=1
|
||||
else
|
||||
local SUPPORTED=0
|
||||
|
|
|
@ -119,13 +119,13 @@ get_arch_specific_cflags() {
|
|||
echo "-arch arm64e -target $(get_target) -march=armv8.3-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64E"
|
||||
;;
|
||||
i386)
|
||||
echo "-arch i386 -target $(get_target) -march=i386 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386"
|
||||
echo "-arch i386 -target $(get_target) -march=i386 -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_I386"
|
||||
;;
|
||||
x86-64)
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64"
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
|
||||
;;
|
||||
x86-64-mac-catalyst)
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks"
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64_MAC_CATALYST -isysroot ${SDK_PATH} -isystem ${SDK_PATH}/System/iOSSupport/usr/include -iframework ${SDK_PATH}/System/iOSSupport/System/Library/Frameworks"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ get_arch_specific_cflags() {
|
|||
echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64"
|
||||
;;
|
||||
x86-64)
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64"
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ get_arch_specific_cflags() {
|
|||
echo "-arch arm64 -target $(get_target) -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64_SIMULATOR"
|
||||
;;
|
||||
x86-64)
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64"
|
||||
echo "-arch x86_64 -target $(get_target) -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user