### FFmpegKit Setup for Desktop (Java)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/search/variables_6.html
Guide to setting up FFmpegKit for desktop Java applications. This involves downloading the necessary JAR files or using a build tool like Maven. Ensure the correct version of FFmpegKit is included in your project.
```xml
com.arthenica
ffmpeg-kit-full
6.0
```
--------------------------------
### Execute FFmpeg Command
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/doc/html/search/variables_16.html
Demonstrates executing a simple FFmpeg command. This example uses FFmpegKit to get the version, which is a basic test of its functionality. The command string is passed directly to the execute method.
```kotlin
package com.arthenica.ffmpegkit.sample
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.arthenica.ffmpegkit.FFmpegKit
import com.arthenica.ffmpegkit.ReturnCode
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val session = FFmpegKit.execute("-version")
val returnCode = session.returnCode
// Check returnCode for success or failure
if (ReturnCode.isSuccess(returnCode)) {
// Command executed successfully
} else if (ReturnCode.isCancel(returnCode)) {
// Command was cancelled
} else {
// Command failed
}
}
}
```
--------------------------------
### Required Build Packages for ffmpeg-kit
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Android-Prerequisites
These are the essential packages that must be installed to successfully build the ffmpeg-kit project. They provide fundamental tools for compilation and dependency management.
```shell
autoconf automake libtool pkg-config curl git doxygen nasm
```
--------------------------------
### Optional Build Packages for External Libraries
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Android-Prerequisites
This list includes optional packages that enable the build of specific external libraries. Install these only if you intend to use the corresponding library features within ffmpeg-kit.
```shell
cmake gcc gperf texinfo yasm bison autogen wget autopoint meson ninja ragel groff gtk-doc-tools libtasn1-1
```
--------------------------------
### FFmpegKit tvOS Framework Strip Script
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Importing-tvOS-Frameworks
A shell script to be added to Xcode's 'Run Script' phase for stripping unnecessary architectures from FFmpegKit frameworks, ensuring compatibility and reducing app size. This is recommended for v4.5.1 and newer releases.
```bash
${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ffmpegkit.framework/strip-frameworks.sh
```
--------------------------------
### Install Linux Packages for FFmpegKit Build
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/linux/README.md
Installs essential packages required for building FFmpegKit on Debian/Ubuntu-based systems. These packages include compilers, development libraries, and tools necessary for native library compilation. Package names may vary on other Linux distributions.
```bash
apt-get update && apt-get install -y clang llvm lld libclang-14-dev libstdc++6 nasm autoconf automake libtool pkg-config curl git doxygen rapidjson-dev
```
--------------------------------
### macOS: Strip frameworks script for older ffmpeg-kit versions
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Importing-macOS-Frameworks
For ffmpeg-kit versions 4.5.1 and newer, include this run script in your Xcode project's Build Phases to strip frameworks. This ensures proper integration of the ffmpeg-kit binaries.
```bash
${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ffmpegkit.framework/Resources/strip-frameworks.sh
```
--------------------------------
### FFmpegKit Execution Example (Android)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/search/variables_6.html
An example of executing an FFmpeg command using FFmpegKit on Android. This code shows how to pass arguments to FFmpeg and handle the execution status. Errors during execution are reported in the logs.
```java
FFmpegKit.executeAsync("-version", new ExecuteCallback() {
@Override
public void apply(ExecuteState executeState, long executionId, long returnCode) {
if (ReturnCode.isSuccess(returnCode)) {
// Command executed successfully
} else if (ReturnCode.isCancel(returnCode)) {
// Command cancelled
} else {
// Command execution failed
}
}
});
```
--------------------------------
### MediaInformation - Get Start Time
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/MediaInformation.html
Retrieves the start time of the media.
```APIDOC
## GET MediaInformation/getStartTime
### Description
Returns the start time of the media.
### Method
GET
### Endpoint
`/media/information/startTime`
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- **startTime** (String) - The media start time.
#### Response Example
```json
{
"startTime": "00:00:00.000"
}
```
```
--------------------------------
### Initialize FFmpeg Options and Execute
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d7/d48/fftools__ffmpeg_8c_source.html
This C function initializes FFmpeg's program name and birth year, defines a set of command-line options, and prepares for execution. It handles options for displaying license, help, version, build configuration, and lists of formats, muxers, demuxers, devices, and codecs. This is the main entry point for executing FFmpeg commands.
```c
int ffmpeg_execute(int argc, char **argv)
{
char _program_name[] = "ffmpeg";
program_name = (char*)&_program_name;
program_birth_year = 2000;
#define OFFSET(x) offsetof(OptionsContext, x)
OptionDef options[] = {
/* main options */
{ "L", OPT_EXIT, { .func_arg = show_license }, "show license" },
{ "h", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" },
{ "?", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" },
{ "help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" },
{ "-help", OPT_EXIT, { .func_arg = show_help }, "show help", "topic" },
{ "version", OPT_EXIT, { .func_arg = show_version }, "show version" },
{ "buildconf", OPT_EXIT, { .func_arg = show_buildconf }, "show build configuration" },
{ "formats", OPT_EXIT, { .func_arg = show_formats }, "show available formats" },
{ "muxers", OPT_EXIT, { .func_arg = show_muxers }, "show available muxers" },
{ "demuxers", OPT_EXIT, { .func_arg = show_demuxers }, "show available demuxers" },
{ "devices", OPT_EXIT, { .func_arg = show_devices }, "show available devices" },
{ "codecs", OPT_EXIT, { .func_arg = show_codecs }, "show available codecs" },
```
--------------------------------
### Get Chapter Start Time in Java
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/Chapter.html
Retrieves the start time of a chapter. This method returns the chapter's start time as a Long. It takes no arguments.
```java
public Long getStart()
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/doc/html/search/variables_4.html
Initializes FFmpegKit. This is a necessary first step before executing any FFmpeg commands. It typically involves setting up the environment and making the FFmpeg binaries available to the application.
```kotlin
FFmpegKitConfig.init(context)
```
--------------------------------
### Get Chapter Start Time as String in Java
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/Chapter.html
Retrieves the start time of a chapter formatted as a String. This method provides a string representation of the chapter's start time. It takes no arguments.
```java
public String getStartTime()
```
--------------------------------
### Install Directories and Linker Options
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/tools/patch/cmake/x265/CMakeLists.txt
Defines the installation directories for libraries and executables, and allows specifying extra libraries and linker flags. The `LIB_INSTALL_DIR`, `BIN_INSTALL_DIR`, `EXTRA_LIB`, and `EXTRA_LINK_FLAGS` variables can be set to customize the build output and linking process.
```cmake
# Build options
set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
if(EXTRA_LINK_FLAGS)
list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
endif()
if(EXTRA_LIB)
option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
endif(EXTRA_LIB)
mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
```
--------------------------------
### Start Session Running
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d2/d81/protocol_session-p.html
Initiates the execution of the current session.
```APIDOC
## POST /session/startRunning
### Description
Starts running the session.
### Method
POST
### Endpoint
/session/startRunning
### Parameters
None
### Request Example
None
### Response
#### Success Response (200)
- (void) - Indicates successful initiation of the session.
#### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Get Media Start Time - C++
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/df/d06/classffmpegkit_1_1_media_information.html
Retrieves the start time of the media. This method returns a shared pointer to a std::string representing the start time in milliseconds. It is part of the MediaInformation class.
```cpp
std::shared_ptr< std::string > ffmpegkit::MediaInformation::getStartTime
(
)
Returns start time.
Returns
media start time in milliseconds
```
--------------------------------
### macOS: Add ffmpeg-kit dependency with Cocoapods
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Importing-macOS-Frameworks
To install ffmpeg-kit using Cocoapods, add the dependency to your project's Podfile and run 'pod install'. Cocoapods handles downloading the necessary libraries and updating project files.
```ruby
target 'YourApp' do
pod 'ffmpeg-kit-ios'
end
```
--------------------------------
### FFprobeKit Methods
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/de/dcd/_f_fprobe_kit_8m_source.html
Provides methods for initializing FFprobeKit, generating default command arguments, listing active sessions, and creating FFprobe sessions.
```APIDOC
## FFprobeKit Methods
### Description
This section details the static methods available in the `FFprobeKit` class for managing FFprobe operations.
### Methods
- **`+ (void)initialize`**
- Initializes the FFprobeKit.
- **`+ (NSArray *)defaultGetMediaInformationCommandArguments:(NSString *)path`**
- Generates default command-line arguments for retrieving media information for a given file path.
- **Parameters:**
- `path` (NSString) - Required - The path to the media file.
- **`+ (NSArray *)listMediaInformationSessions`**
- Returns a list of all currently active `MediaInformationSession` objects.
- **`+ (NSArray *)listFFprobeSessions`**
- Returns a list of all currently active `FFprobeSession` objects.
### Request Example
```json
{
"method": "POST",
"endpoint": "/ffprobe/initialize"
}
```
### Response Example
```json
{
"status": "success"
}
```
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/search/enumvalues_7.html
Initializes the FFmpegKit framework. This is typically the first step before performing any media operations. It might involve setting up necessary configurations or resources.
```kotlin
FFmpegKitConfig.init(applicationContext)
FFmpegKit.executeAsync("-version") { session ->
Log.d("FFmpegLog", session.output)
}
```
--------------------------------
### Get Media Start Time (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d1/dc9/_media_information_8cpp_source.html
Fetches the start time of the media playback. It utilizes the `getStringFormatProperty` function with the `KeyStartTime` to retrieve this specific piece of metadata.
```cpp
std::shared_ptr ffmpegkit::MediaInformation::getStartTime() {
return getStringFormatProperty(KeyStartTime);
}
```
--------------------------------
### Configuration and Initialization (C)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d8/d4e/fftools__cmdutils_8h_source.html
Functions related to configuration and initialization within FFmpeg Kit. init_dynload is likely for dynamic library loading, and setup_find_stream_info_opts prepares options for stream information discovery. These functions set up the necessary environment for media processing.
```c
void init_dynload(void);
```
```c
AVDictionary *setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *codec_opts);
```
--------------------------------
### Install specific ffmpeg_kit_flutter package
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/flutter/flutter/README.md
This example demonstrates how to install a specific package of ffmpeg_kit_flutter that includes particular external libraries. Replace `` with the desired package, such as `ffmpeg_kit_flutter_lame`.
```yaml
dependencies:
ffmpeg_kit_flutter_: 6.0.3
```
--------------------------------
### FFmpeg Initialization and Setup in C
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/doc/html/d7/d48/fftools__ffmpeg_8c_source.html
Initializes FFmpeg components, sets logging flags, registers all available devices, and initializes network protocols. This function is crucial for preparing FFmpeg for subsequent operations.
```c
int savedCode = setjmp(ex_buf__);
if (savedCode == 0) {
ffmpeg_var_cleanup();
init_dynload();
register_exit(ffmpeg_cleanup);
av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);
#if CONFIG_AVDEVICE
avdevice_register_all();
#endif
avformat_network_init();
show_banner(argc, argv, options);
ret = ffmpeg_parse_options(argc, argv);
if (ret < 0)
exit_program(1);
if (nb_output_files <= 0 && nb_input_files == 0) {
show_usage();
av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
exit_program(1);
}
if (nb_output_files <= 0) {
av_log(NULL, AV_LOG_FATAL, "At least one output file must be specified\n");
exit_program(1);
}
}
```
--------------------------------
### Get Chapter Start Value (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d1/d8a/_chapter_8cpp_source.html
This C++ function retrieves the start value of an FFmpegKit chapter, typically representing a time or frame number. It uses `getNumberProperty` with the key 'start' and returns a shared pointer to an int64_t.
```cpp
std::shared_ptr ffmpegkit::Chapter::getStart() {
return getNumberProperty("start");
}
```
--------------------------------
### Get Start Time from FFmpegKit Chapter (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d1/d8a/_chapter_8cpp_source.html
This C++ method is designed to retrieve the start time of an FFmpegKit chapter. It assumes the start time is stored as a string and returns it as a shared pointer. The implementation checks for the existence of chapter data.
```cpp
std::shared_ptr ffmpegkit::Chapter::getStartTime() {
return getStringProperty("start_time");
}
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/search/functions_13.html
Initializes the FFmpegKit library. This is typically the first step before performing any media operations. It might involve setting up native libraries and configurations.
```java
FFmpegKit.execute("-version");
```
--------------------------------
### FFmpegKit Execution Example (iOS)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/search/variables_6.html
A basic example of running an FFmpeg command using FFmpegKit in an iOS application. This code snippet illustrates calling the FFmpeg executable with provided arguments. Results and status are returned via callbacks.
```objectivec
NSString *arguments = @"-version";
[FFprobeKit executeAsync:arguments withCompleteBlock:^(FFprobeKitExecuteState executeState, NSInteger returnCode, id logs) {
if (ReturnCode.isSuccess(returnCode)) {
// Command executed successfully
} else {
// Command failed or was cancelled
}
}];
```
--------------------------------
### Get Start Time - C++
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/dfd/_abstract_session_8cpp_source.html
Retrieves the timestamp when the ffmpeg session started execution. The timestamp is of type std::chrono::time_point.
```cpp
std::chrono::time_point ffmpegkit::AbstractSession::getStartTime() const {
return _startTime;
}
```
--------------------------------
### AbstractSession Instance Methods
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/db/de2/interface_abstract_session.html
Reference for instance methods of the AbstractSession class, detailing session initialization, state management, logging, and execution.
```APIDOC
## AbstractSession Instance Methods
### Description
Provides access to various instance methods for managing and querying FFmpegKit sessions.
### Methods
- **init:withLogCallback:withLogRedirectionStrategy:** Initializes a new session.
- **waitForAsynchronousMessagesInTransmit:** Waits for asynchronous messages during transmission.
- **getLogCallback:** Retrieves the current log callback.
- **getSessionId:** Gets the unique identifier for the session.
- **getCreateTime:** Returns the timestamp when the session was created.
- **getStartTime:** Returns the timestamp when the session started execution.
- **getEndTime:** Returns the timestamp when the session finished execution.
- **getDuration:** Calculates and returns the duration of the session in seconds.
- **getArguments:** Retrieves the arguments used to configure the FFmpeg command.
- **getCommand:** Gets the FFmpeg command string associated with the session.
- **getAllLogsWithTimeout:** Retrieves all logs with a specified timeout.
- **getAllLogs:** Retrieves all logs from the session.
- **getLogs:** Retrieves logs based on the current session state.
- **getAllLogsAsStringWithTimeout:** Retrieves all logs as a string with a specified timeout.
- **getAllLogsAsString:** Retrieves all logs as a string.
- **getLogsAsString:** Retrieves logs as a string.
- **getOutput:** Gets the output generated by the FFmpeg process.
- **getState:** Retrieves the current state of the FFmpeg session.
- **getReturnCode:** Gets the return code indicating the success or failure of the FFmpeg process.
- **getFailStackTrace:** Retrieves the stack trace if the session failed.
- **getLogRedirectionStrategy:** Gets the strategy used for redirecting logs.
- **thereAreAsynchronousMessagesInTransmit:** Checks if there are pending asynchronous messages.
- **addLog:** Adds a custom log message to the session.
- **startRunning:** Starts the execution of the FFmpeg command.
- **complete:** Marks the session as completed.
- **fail:** Marks the session as failed with a specific error.
- **isFFmpeg:** Checks if the session is for FFmpeg.
- **isFFprobe:** Checks if the session is for FFprobe.
- **isMediaInformation:** Checks if the session is for MediaInformation.
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/search/variables_0.html
Initializes FFmpegKit and registers necessary commands. This is a foundational step before executing any FFmpeg operations. It typically involves calling a static initialization method.
```kotlin
FFmpegKitConfig.init();
```
--------------------------------
### FFmpegKit AbstractSession - Get Start Time (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d2/d41/classffmpegkit_1_1_abstract_session.html
Returns the time point when the FFmpeg session officially started processing. This helps in measuring the actual execution time.
```cpp
std::chrono::time_point getStartTime() const override
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/search/all_3.html
This snippet demonstrates how to initialize FFmpegKit. Proper initialization is crucial before executing any FFmpeg commands. It typically involves calling a static initialization method provided by the library.
```java
FFmpegKitConfig.init(context);
// Further configuration can be done here if needed
```
--------------------------------
### Installing Specific LTS Versions in Flutter
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Tips
When specifying LTS versions of `ffmpeg_kit_flutter` in `pubspec.yaml` using caret syntax (e.g., `^4.5.0-LTS`), `flutter pub get` might install a non-LTS version. To ensure the correct LTS version is installed, define the exact LTS version number without using caret syntax.
```yaml
dependencies:
ffmpeg_kit_flutter:
version: "4.5.0-LTS"
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/doc/html/search/variables_16.html
This snippet shows how to initialize FFmpegKit. Ensure this is called before executing any FFmpeg commands. It typically involves setting up necessary configurations.
```kotlin
package com.arthenica.ffmpegkit.sample
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.arthenica.ffmpegkit.FFmpegKit
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
FFmpegKit.execute("-version")
}
}
```
--------------------------------
### FFmpeg Kit Initialization and Processing (C)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d7/d48/fftools__ffmpeg_8c_source.html
Initializes FFmpeg Kit, sets up logging, registers necessary components (like avdevice), parses command-line arguments, and initiates the file transcoding process. It includes checks for required output files and handles program exit codes for various scenarios. This is the primary entry point for FFmpeg operations.
```c
int savedCode = setjmp(ex_buf__);
if (savedCode == 0) {
ffmpeg_var_cleanup();
init_dynload();
register_exit(ffmpeg_cleanup);
av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);
#if CONFIG_AVDEVICE
avdevice_register_all();
#endif
avformat_network_init();
show_banner(argc, argv, options);
/* parse options and open all input/output files */
ret = ffmpeg_parse_options(argc, argv);
if (ret < 0)
exit_program(1);
if (nb_output_files <= 0 && nb_input_files == 0) {
show_usage();
av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
exit_program(1);
}
/* file converter / grab */
if (nb_output_files <= 0) {
av_log(NULL, AV_LOG_FATAL, "At least one output file must be specified\n");
exit_program(1);
}
current_time = ti = get_benchmark_time_stamps();
if (transcode() < 0)
exit_program(1);
if (do_benchmark) {
int64_t utime, stime, rtime;
current_time = get_benchmark_time_stamps();
utime = current_time.user_usec - ti.user_usec;
stime = current_time.sys_usec - ti.sys_usec;
rtime = current_time.real_usec - ti.real_usec;
av_log(NULL, AV_LOG_INFO,
"bench: utime=%0.3fs stime=%0.3fs rtime=%0.3fs\n",
utime / 1000000.0, stime / 1000000.0, rtime / 1000000.0);
}
av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" frames successfully decoded, %"PRIu64" decoding errors\n",
decode_error_stat[0], decode_error_stat[1]);
if ((decode_error_stat[0] + decode_error_stat[1]) * max_error_rate < decode_error_stat[1])
exit_program(69);
}
```
--------------------------------
### Get Media Information Async (with Executor Service)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution using a provided ExecutorService. The method returns immediately.
```APIDOC
## getMediaInformationAsync (with ExecutorService)
### Description
Starts an asynchronous FFprobe execution to extract media information for a specified file, utilizing a provided ExecutorService for running the operation. This method returns immediately.
### Method
`GET` (conceptually)
### Endpoint
`/media/information/async` (Conceptual endpoint)
### Parameters
#### Path Parameters
None
#### Query Parameters
- **path** (String) - Required - Path or URI of a media file
#### Request Body
None
### Request Example
```json
{
"path": "/path/to/your/audio.mp3"
}
```
### Response
#### Success Response (200 - Conceptual)
- **MediaInformationSession** (Object) - Represents the ongoing asynchronous operation.
#### Response Example
(Handled via callback)
```json
{
"sessionId": "executor-id",
"status": "running"
}
```
```
--------------------------------
### Get Duration - C++
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/dfd/_abstract_session_8cpp_source.html
Calculates and returns the duration of the ffmpeg session in milliseconds. It returns 0 if the start or end times are not set.
```cpp
long ffmpegkit::AbstractSession::getDuration() const {
const std::chrono::time_point startTime = _startTime;
const std::chrono::time_point endTime = _endTime;
if (startTime.time_since_epoch() != std::chrono::microseconds(0) && endTime.time_since_epoch() != std::chrono::microseconds(0)) {
return std::chrono::duration_cast(endTime - startTime).count();
}
return 0;
}
```
--------------------------------
### FFprobeSession Constructor
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/d5c/classffmpegkit_1_1_f_fprobe_session.html
The primary constructor for FFprobeSession, allowing initialization with arguments, completion callback, log callback, and log redirection strategy. This offers the most granular control over FFprobe session setup.
```cpp
ffmpegkit::FFprobeSession::FFprobeSession(
const std::list< std::string > &arguments,
const FFprobeSessionCompleteCallback completeCallback,
const ffmpegkit::LogCallback logCallback,
const LogRedirectionStrategy logRedirectionStrategy
)
```
--------------------------------
### Get FFmpeg Version
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/search/functions_1.html
Retrieves the FFmpeg version information. This is useful for verifying the installed FFmpeg version or for compatibility checks. It returns a string containing the version details.
```java
String version = FFmpegKit.getVersion();
```
--------------------------------
### Initialize FFmpegKit
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/search/typedefs_6.html
Initializes FFmpegKit for use within your application. This is a necessary first step before executing any FFmpeg commands.
```kotlin
FFmpegKitConfig.init(application)
FFmpegKit.execute("-version")
```
--------------------------------
### Setup Stream Info Options (C)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d7/dcc/fftools__cmdutils_8c.html
Sets up AVDictionary options for avformat_find_stream_info(). It creates an array of dictionaries, one for each stream in the input format context, merging provided codec options. Exits on failure.
```c
AVDictionary ** setup_find_stream_info_opts(
AVFormatContext * s,
AVDictionary * codec_opts
)
{
// ... implementation details ...
return NULL;
}
```
--------------------------------
### Get Media Information Async (with Log Callback)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution with an optional log callback and wait timeout. The method returns immediately.
```APIDOC
## getMediaInformationAsync (with logs and timeout)
### Description
Starts an asynchronous FFprobe execution to extract media information for a specified file, including the ability to receive logs and set a wait timeout. This method returns immediately.
### Method
`GET` (conceptually)
### Endpoint
`/media/information/async` (Conceptual endpoint)
### Parameters
#### Path Parameters
None
#### Query Parameters
- **path** (String) - Required - Path or URI of a media file
- **waitTimeout** (int) - Optional - Maximum time to wait until media information is transmitted
#### Request Body
None
### Request Example
```json
{
"path": "/path/to/your/media.mov",
"waitTimeout": 5000
}
```
### Response
#### Success Response (200 - Conceptual)
- **MediaInformationSession** (Object) - Represents the ongoing asynchronous operation.
#### Response Example
(Handled via callback)
```json
{
"sessionId": "another-unique-id",
"status": "running"
}
```
```
--------------------------------
### Get Media Information using FFprobe
Source: https://github.com/arthenica/ffmpeg-kit/wiki/macOS
This example retrieves media information for a given file path or URI using FFprobeKit. It shows how to obtain the MediaInformation object.
```objectivec
MediaInformationSession *mediaInformation = [FFprobeKit getMediaInformation:@""];
MediaInformation *mediaInformation =[mediaInformation getMediaInformation];
```
--------------------------------
### Create FFmpegSession with Arguments
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d2/def/_f_fmpeg_session_8h_source.html
Creates an FFmpegSession with the provided list of arguments. This is the most basic way to initiate an FFmpeg command execution.
```cpp
static std::shared_ptr create(const std::list& arguments);
```
--------------------------------
### FFprobeKit Initialization
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d6/d36/interface_f_fprobe_kit.html
Initializes the FFprobeKit. This is a class method that should be called once before using other FFprobeKit functionalities.
```APIDOC
## POST /initialize
### Description
Initializes the FFprobeKit.
### Method
POST
### Endpoint
/initialize
### Parameters
None
### Request Example
```json
{}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the initialization status.
#### Response Example
```json
{
"status": "initialized"
}
```
```
--------------------------------
### Get Media Information (Asynchronous)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/df/d3f/classffmpegkit_1_1_f_fprobe_kit.html
Starts an asynchronous FFprobe execution to extract media information for a specified file. This method returns immediately.
```APIDOC
## POST /media/information/async
### Description
Starts an asynchronous FFprobe execution to extract the media information for the specified file. This method returns immediately and does not wait for the execution to complete.
### Method
POST
### Endpoint
`/media/information/async`
### Parameters
#### Query Parameters
- **path** (string) - Required - The path or URI of the media file.
- **completeCallback** (function) - Required - A callback function that will be called when the execution has completed.
- **logCallback** (function) - Optional - A callback function that will receive logs during execution.
- **waitTimeout** (integer) - Optional - The maximum time in milliseconds to wait for media information to be transmitted.
### Request Body
(No request body for this endpoint, parameters are typically passed via query or function arguments in the SDK)
### Response
#### Success Response (200)
- **session** (object) - A MediaInformationSession object created for this execution.
#### Response Example
```json
{
"session": {
"id": "some-session-id"
}
}
```
```
--------------------------------
### Get Media Information Async (Full Options)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution with all options: log callback, ExecutorService, and wait timeout. The method returns immediately.
```APIDOC
## getMediaInformationAsync (Full Options)
### Description
Starts an asynchronous FFprobe execution to extract media information for a specified file, providing comprehensive options including log callback, ExecutorService, and wait timeout. This method returns immediately.
### Method
`GET` (conceptually)
### Endpoint
`/media/information/async` (Conceptual endpoint)
### Parameters
#### Path Parameters
None
#### Query Parameters
- **path** (String) - Required - Path or URI of a media file
- **waitTimeout** (int) - Optional - Maximum time to wait until media information is transmitted
#### Request Body
None
### Request Example
```json
{
"path": "/path/to/your/video.avi",
"waitTimeout": 10000
}
```
### Response
#### Success Response (200 - Conceptual)
- **MediaInformationSession** (Object) - Represents the ongoing asynchronous operation.
#### Response Example
(Handled via callback)
```json
{
"sessionId": "full-options-id",
"status": "running"
}
```
```
--------------------------------
### Configuration and Utility Methods
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/functions_func_g.html
Methods for retrieving configuration details and general utility values.
```APIDOC
## Configuration and Utility Methods
### Description
Provides methods to access configuration settings and utility values like return codes and versions.
### Methods
- **getValue()**: Returns the value from `ffmpegkit::ReturnCode`.
- **getVersion()**: Returns the FFmpegKit version from `ffmpegkit::FFmpegKitConfig`.
### Request
No specific request body or parameters are detailed for these getter methods.
### Response
The response type depends on the method: `Object` for `getValue()` and `String` for `getVersion()`.
```
--------------------------------
### MediaInformationSession Creation
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/df/db7/classffmpegkit_1_1_media_information_session.html
Static methods for creating instances of `MediaInformationSession` with different callback configurations.
```APIDOC
## MediaInformationSession Creation API
### Description
This section provides static factory methods for creating `MediaInformationSession` objects, allowing for configuration with callbacks for completion and logging.
### Static Methods
#### Create MediaInformationSession (Arguments Only)
* **Method:** `static std::shared_ptr create(const std::list& arguments);`
* **Description:** Creates a `MediaInformationSession` with the specified FFmpeg arguments.
* **Parameters:**
* `arguments` (const std::list&) - Required - A list of strings representing the FFmpeg arguments.
* **Returns:** A shared pointer to a newly created `MediaInformationSession`.
#### Create MediaInformationSession (With Completion Callback)
* **Method:** `static std::shared_ptr create(const std::list& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback);`
* **Description:** Creates a `MediaInformationSession` with FFmpeg arguments and a callback function to be executed upon session completion.
* **Parameters:**
* `arguments` (const std::list&) - Required - A list of strings representing the FFmpeg arguments.
* `completeCallback` (ffmpegkit::MediaInformationSessionCompleteCallback) - Required - The callback function to execute when the session completes.
* **Returns:** A shared pointer to a newly created `MediaInformationSession`.
#### Create MediaInformationSession (With Callbacks)
* **Method:** `static std::shared_ptr create(const std::list& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback);`
* **Description:** Creates a `MediaInformationSession` with FFmpeg arguments, a completion callback, and a log callback.
* **Parameters:**
* `arguments` (const std::list&) - Required - A list of strings representing the FFmpeg arguments.
* `completeCallback` (ffmpegkit::MediaInformationSessionCompleteCallback) - Required - The callback function to execute when the session completes.
* `logCallback` (ffmpegkit::LogCallback) - Required - The callback function to execute for log messages.
* **Returns:** A shared pointer to a newly created `MediaInformationSession`.
```
--------------------------------
### Get Media Information Asynchronously
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution to extract media information for a specified file. This method allows for detailed callbacks for completion and logging.
```APIDOC
## GET /media/information/async
### Description
Starts an asynchronous FFprobe execution to extract the media information for the specified file.
### Method
GET
### Endpoint
/media/information/async
### Parameters
#### Query Parameters
- **path** (String) - Required - The path to the media file.
- **completeCallback** (MediaInformationSessionCompleteCallback) - Required - Callback for when the session completes.
- **logCallback** (LogCallback) - Optional - Callback for logging.
- **executorService** (ExecutorService) - Optional - The executor service to use for the asynchronous task.
- **waitTimeout** (int) - Optional - The timeout in milliseconds for the FFprobe execution.
### Request Example
```json
{
"path": "/path/to/your/media.mp4",
"completeCallback": "",
"logCallback": "",
"executorService": "",
"waitTimeout": 5000
}
```
### Response
#### Success Response (200)
- **MediaInformationSession** (MediaInformationSession) - The session object containing media information.
#### Response Example
```json
{
"mediaInformationSession": {
""
}
}
```
```
--------------------------------
### Create FFprobeSession (With Completion and Log Callbacks)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/d5c/classffmpegkit_1_1_f_fprobe_session.html
Creates a new FFprobe session with command arguments, a completion callback, and a log callback. This provides comprehensive control over session completion and real-time logging.
```cpp
std::shared_ptr ffmpegkit::FFprobeSession::create(
const std::list< std::string > &arguments,
const FFprobeSessionCompleteCallback completeCallback,
const ffmpegkit::LogCallback logCallback
)
```
--------------------------------
### FFmpegKitConfig - Initialization and Execution
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/de/d5f/interface_f_fmpeg_kit_config.html
Methods for initializing FFmpegKit and executing FFmpeg commands asynchronously.
```APIDOC
## FFmpegKitConfig - Initialization and Execution
### Description
Methods for initializing the FFmpegKit library and executing FFmpeg commands asynchronously.
### Methods
#### POST /initialize
##### Description
Initializes the FFmpegKit library.
##### Endpoint
`/initialize`
#### POST /execute/async
##### Description
Starts an asynchronous FFmpeg execution for the given session. Returns immediately.
##### Parameters
* **ffmpegSession** (FFmpegSession*) - Required - The FFmpeg session containing command options and arguments.
##### Endpoint
`/execute/async`
##### Notes
Use an `FFmpegSessionCompleteCallback` to be notified about the execution result.
```
--------------------------------
### FFmpegKit AbstractSession - Get Duration (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d2/d41/classffmpegkit_1_1_abstract_session.html
Calculates and returns the total duration of the FFmpeg session in milliseconds. This is derived from the start and end times.
```cpp
long getDuration() const override
```
--------------------------------
### Create FFmpegSession with Arguments
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFmpegSession.html
Builds a new FFmpeg session using provided arguments. This is a basic method to initiate an FFmpeg process.
```java
static FFmpegSession create(Array arguments)
```
--------------------------------
### Add FFmpegKit Dependency using Cocoapods
Source: https://github.com/arthenica/ffmpeg-kit/wiki/Importing-tvOS-Frameworks
Integrates FFmpegKit into a tvOS project by adding its dependency to the project's Podfile. This method automates the download and management of FFmpegKit libraries.
```ruby
# Podfile
platform :tvos, '11.0'
target 'YourAppTarget' do
use_frameworks!
pod 'ffmpeg-kit-min-ios-tvos', '~> 4.4'
end
```
--------------------------------
### Initialize Hardware Device (C)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/d66/fftools__ffmpeg__opt_8c_source.html
Initializes a hardware device based on the provided argument. If the argument is 'list', it enumerates and prints all supported hardware device types. Otherwise, it attempts to initialize a device from a string.
```c
int opt_init_hw_device(void *optctx, const char *opt, const char *arg)
{
if (!strcmp(arg, "list")) {
enum AVHWDeviceType type = AV_HWDEVICE_TYPE_NONE;
av_log(NULL, AV_LOG_STDERR, "Supported hardware device types:\n");
while ((type = av_hwdevice_iterate_types(type)) !=
AV_HWDEVICE_TYPE_NONE)
av_log(NULL, AV_LOG_STDERR, "%s\n", av_hwdevice_get_type_name(type));
av_log(NULL, AV_LOG_STDERR, "\n");
exit_program(0);
} else {
return hw_device_init_from_string(arg, NULL);
}
}
```
--------------------------------
### FFprobeSession::create() Overloads
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/da/d5c/classffmpegkit_1_1_f_fprobe_session.html
Static methods for creating FFprobe sessions. These methods allow for flexibility in providing callbacks.
```APIDOC
## Static Methods for FFprobeSession Creation
### Description
These static methods provide convenient ways to instantiate `FFprobeSession` objects.
### Method
static std::shared_ptr
### Endpoint
N/A (Class methods)
### Parameters
#### `create(const std::list &arguments)`
- **arguments** (list) - Required - Command arguments for FFprobe.
#### `create(const std::list &arguments, const FFprobeSessionCompleteCallback completeCallback)`
- **arguments** (list) - Required - Command arguments for FFprobe.
- **completeCallback** (FFprobeSessionCompleteCallback) - Optional - Callback function to be executed upon session completion.
#### `create(const std::list &arguments, const FFprobeSessionCompleteCallback completeCallback, const ffmpegkit::LogCallback logCallback)`
- **arguments** (list) - Required - Command arguments for FFprobe.
- **completeCallback** (FFprobeSessionCompleteCallback) - Optional - Callback function to be executed upon session completion.
- **logCallback** (ffmpegkit::LogCallback) - Optional - Callback function for receiving log messages.
#### `create(const std::list &arguments, const FFprobeSessionCompleteCallback completeCallback, const ffmpegkit::LogCallback logCallback, const LogRedirectionStrategy logRedirectionStrategy)`
- **arguments** (list) - Required - Command arguments for FFprobe.
- **completeCallback** (FFprobeSessionCompleteCallback) - Optional - Callback function to be executed upon session completion.
- **logCallback** (ffmpegkit::LogCallback) - Optional - Callback function for receiving log messages.
- **logRedirectionStrategy** (LogRedirectionStrategy) - Optional - Strategy for redirecting log messages.
### Returns
- `std::shared_ptr` - A shared pointer to the newly created FFprobe session.
### Example Usage (Conceptual)
```cpp
// Using the simplest overload
auto session1 = ffmpegkit::FFprobeSession::create({"-i", "input.mp4"});
// With a completion callback
auto session2 = ffmpegkit::FFprobeSession::create({"-i", "input.mp4"}, myCompletionHandler);
// With completion and log callbacks
auto session3 = ffmpegkit::FFprobeSession::create({"-i", "input.mp4"}, myCompletionHandler, myLogHandler);
// With all parameters
auto session4 = ffmpegkit::FFprobeSession::create({"-i", "input.mp4"}, myCompletionHandler, myLogHandler, ffmpegkit::LogRedirectionStrategy::STRATEGY_FORWARD_ALL);
```
```
--------------------------------
### Get Media Information Async (Basic)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution to extract media information for a specified file. This method returns immediately. A MediaInformationSessionCompleteCallback must be used to be notified about the result.
```APIDOC
## getMediaInformationAsync
### Description
Starts an asynchronous FFprobe execution to extract the media information for the specified file. This method returns immediately and does not wait for the execution to complete. You must use a MediaInformationSessionCompleteCallback to be notified about the result.
### Method
`GET` (conceptually, as it's an asynchronous operation initiated by a method call)
### Endpoint
`/media/information/async` (Conceptual endpoint for the operation)
### Parameters
#### Path Parameters
None
#### Query Parameters
- **path** (String) - Required - Path or URI of a media file
#### Request Body
None
### Request Example
```json
{
"path": "/path/to/your/media.mp4"
}
```
### Response
#### Success Response (200 - Conceptual)
- **MediaInformationSession** (Object) - An object representing the ongoing asynchronous operation.
#### Response Example
(Note: This is a conceptual representation as the actual response is handled via callback)
```json
{
"sessionId": "some-unique-id",
"status": "running"
}
```
```
--------------------------------
### Initialize Dynamic Loading - C
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d8/d4e/fftools__cmdutils_8h.html
Initializes the dynamic library loading mechanism. This function has no parameters and returns void, indicating it performs setup operations for dynamic linking.
```c
/*
* Initialize dynamic library loading
*
* Definition at line 123 of file fftools_cmdutils.c.
*/
void init_dynload(
void
);
```
--------------------------------
### Get Media Information From Command Asynchronously
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/android/javadoc/com/arthenica/ffmpegkit/FFprobeKit.html
Starts an asynchronous FFprobe execution using a command that is expected to generate JSON output. This method returns immediately and uses callbacks for completion and logging.
```APIDOC
## POST /media/information/command/async
### Description
Starts an asynchronous FFprobe execution to extract media information using a command. The command passed to this method must generate the output in JSON format in order to successfully extract media information from it.
### Method
POST
### Endpoint
/media/information/command/async
### Parameters
#### Request Body
- **command** (String) - Required - The FFprobe command to execute (must produce JSON output).
- **completeCallback** (MediaInformationSessionCompleteCallback) - Required - Callback for when the session completes.
- **logCallback** (LogCallback) - Optional - Callback for logging.
- **waitTimeout** (int) - Optional - The timeout in milliseconds for the FFprobe execution.
### Request Example
```json
{
"command": "ffprobe -v quiet -print_format json -show_format -show_streams /path/to/your/media.mp4",
"completeCallback": "",
"logCallback": "",
"waitTimeout": 5000
}
```
### Response
#### Success Response (200)
- **MediaInformationSession** (MediaInformationSession) - The session object representing the asynchronous operation.
#### Response Example
```json
{
"mediaInformationSession": {
""
}
}
```
```
--------------------------------
### Async Media Information Execution
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/de/d5f/interface_f_fmpeg_kit_config.html
Starts an asynchronous execution for media information retrieval. The method returns immediately.
```APIDOC
## POST /media-information/execute/async
### Description
Starts an asynchronous execution for the given media information session. This method returns immediately and does not wait for the execution to complete. Use an `MediaInformationSessionCompleteCallback` for notifications.
### Method
POST
### Endpoint
/media-information/execute/async
### Parameters
#### Request Body
- **mediaInformationSession** (MediaInformationSession) - Required - The media information session object.
- **queue** (dispatch_queue_t) - Optional - The dispatch queue to use for running the asynchronous operation.
- **waitTimeout** (int) - Optional - The maximum time to wait for media information to be transmitted.
### Request Example
```json
{
"mediaInformationSession": { ... },
"queue": "com.example.media.queue",
"waitTimeout": 30
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of initiating the asynchronous execution.
#### Response Example
```json
{
"status": "initiated"
}
```
```
--------------------------------
### FFmpegKit AbstractSession - Get End Time (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d2/d41/classffmpegkit_1_1_abstract_session.html
Retrieves the time point when the FFmpeg session finished its execution. This, along with start time, provides the total duration.
```cpp
std::chrono::time_point getEndTime() const override
```
--------------------------------
### C: Initialize Hardware Device from String
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d7/db3/fftools__ffmpeg_8h.html
The hw_device_init_from_string function initializes a hardware device based on a string argument. It takes the argument string and a pointer to a HWDevice pointer, which will be populated with the newly created device. This function facilitates dynamic hardware device setup.
```c
int hw_device_init_from_string(
const char *arg,
HWDevice **dev
);
```
--------------------------------
### Initialize Media Information with Dictionary, Streams, and Chapters (Objective-C)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d6/dca/interface_media_information.html
Initializes an instance of a media information object with a media dictionary, an array of streams, and an array of chapters. This constructor is essential for setting up the media information structure upon creation. It takes a dictionary and two arrays as input.
```objective-c
- (instancetype) init: (NSDictionary *) _mediaDictionary withStreams: (NSArray *) _streams withChapters: (NSArray *) _chapters
```
--------------------------------
### FFmpegKit AbstractSession - Get Logs (C++)
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/linux/html/d2/d41/classffmpegkit_1_1_abstract_session.html
Retrieves the log entries that have been generated since the last call to this method or since the session started. This provides a way to fetch logs incrementally.
```cpp
std::shared_ptr>> getLogs() const override
```
--------------------------------
### Transcoding Initialization
Source: https://github.com/arthenica/ffmpeg-kit/blob/main/docs/apple/html/d7/d48/fftools__ffmpeg_8c_source.html
Initializes the transcoding process. This is a setup function that prepares the environment and structures needed for the main transcoding loop. It returns an error code if initialization fails.
```c
ret = transcode_init();
if (ret < 0)
goto fail;
```