# FFmpegKit Linux API: ffmpegkit::FFmpegKit Class Reference

ffmpegkit::FFmpegKit Class Reference

`#include <FFmpegKit.h>`

## Static Public Member Functions

static std::shared_ptr< ffmpegkit::FFmpegSession > | executeWithArguments (const std::list< std::string > &arguments)
static std::shared_ptr< ffmpegkit::FFmpegSession > | executeWithArgumentsAsync (const std::list< std::string > &arguments, FFmpegSessionCompleteCallback completeCallback)
static std::shared_ptr< ffmpegkit::FFmpegSession > | executeWithArgumentsAsync (const std::list< std::string > &arguments, FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback)
static std::shared_ptr< ffmpegkit::FFmpegSession > | execute (const std::string command)
static std::shared_ptr< ffmpegkit::FFmpegSession > | executeAsync (const std::string command, FFmpegSessionCompleteCallback completeCallback)
static std::shared_ptr< ffmpegkit::FFmpegSession > | executeAsync (const std::string command, FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback)
static void | cancel ()
static void | cancel (const long sessionId)
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > | listSessions ()

## Detailed Description

Main class to run `FFmpeg` commands. Supports executing commands both synchronously and asynchronously.

    auto session = FFmpegKit::execute:("-i file1.mp4 -c:v libxvid file1.avi");

    auto asyncSession = FFmpegKit::executeAsync:("-i file1.mp4 -c:v libxvid file1.avi", [](auto session){ ... });

Provides overloaded `execute` methods to define session specific callbacks.

    auto asyncSession = FFmpegKit::executeAsync:("-i file1.mp4 -c:v libxvid file1.avi, [](auto session){ ... }, [](auto log){ ... }, [](auto statistics){ ... });

Definition at line 44 of file FFmpegKit.h.

## Member Function Documentation

## cancel() [1/2]

void ffmpegkit::FFmpegKit::cancel | ( |  | ) |

static

Cancels all running sessions.

This method does not wait for termination to complete and returns immediately.

Definition at line 68 of file FFmpegKit.cpp.

## cancel() [2/2]

void ffmpegkit::FFmpegKit::cancel | ( | const long | sessionId | ) |

static

Cancels the session specified with `sessionId`.

This method does not wait for termination to complete and returns immediately.

Parameters

  sessionId | id of the session that will be cancelled

Definition at line 77 of file FFmpegKit.cpp.

## execute()

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::execute | ( | const std::string | command | ) |

static

Synchronously executes FFmpeg command provided. Space character is used to split command into arguments. You can use single or double quote characters to specify arguments inside your command.

Parameters

  command | FFmpeg command

Returns
  FFmpeg session created for this execution

Definition at line 50 of file FFmpegKit.cpp.

## executeAsync() [1/2]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::executeAsync | ( | const std::string | command,
|  | FFmpegSessionCompleteCallback | completeCallback
| ) |  |

static

Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.

Parameters

  command | FFmpeg command
  completeCallback | callback that will be called when the execution has completed

Returns
  FFmpeg session created for this execution

Definition at line 56 of file FFmpegKit.cpp.

## executeAsync() [2/2]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::executeAsync | ( | const std::string | command,
|  | FFmpegSessionCompleteCallback | completeCallback,
|  | ffmpegkit::LogCallback | logCallback,
|  | ffmpegkit::StatisticsCallback | statisticsCallback
| ) |  |

static

Starts an asynchronous FFmpeg execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.

Parameters

  command | FFmpeg command
  completeCallback | callback that will be called when the execution has completed
  logCallback | callback that will receive logs
  statisticsCallback | callback that will receive statistics

Returns
  FFmpeg session created for this execution

Definition at line 62 of file FFmpegKit.cpp.

## executeWithArguments()

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::executeWithArguments | ( | const std::list< std::string > & | arguments | ) |

static

Synchronously executes FFmpeg with arguments provided.

Parameters

  arguments | FFmpeg command options/arguments as string list

Returns
  FFmpeg session created for this execution

Definition at line 32 of file FFmpegKit.cpp.

## executeWithArgumentsAsync() [1/2]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::executeWithArgumentsAsync | ( | const std::list< std::string > & | arguments,
|  | FFmpegSessionCompleteCallback | completeCallback
| ) |  |

static

Starts an asynchronous FFmpeg execution with arguments provided.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.

Parameters

  arguments | FFmpeg command options/arguments as string list
  completeCallback | callback that will be called when the execution has completed

Returns
  FFmpeg session created for this execution

Definition at line 38 of file FFmpegKit.cpp.

## executeWithArgumentsAsync() [2/2]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegKit::executeWithArgumentsAsync | ( | const std::list< std::string > & | arguments,
|  | FFmpegSessionCompleteCallback | completeCallback,
|  | ffmpegkit::LogCallback | logCallback,
|  | ffmpegkit::StatisticsCallback | statisticsCallback
| ) |  |

static

Starts an asynchronous FFmpeg execution with arguments provided.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.

Parameters

  arguments | FFmpeg command options/arguments as string list
  completeCallback | callback that will be called when the execution has completed
  logCallback | callback that will receive logs
  statisticsCallback | callback that will receive statistics

Returns
  FFmpeg session created for this execution

Definition at line 44 of file FFmpegKit.cpp.

## listSessions()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > ffmpegkit::FFmpegKit::listSessions | ( |  | ) |

static

Lists all FFmpeg sessions in the session history.

Returns
  all FFmpeg sessions in the session history

Definition at line 81 of file FFmpegKit.cpp.

The documentation for this class was generated from the following files:

- FFmpegKit.h
- FFmpegKit.cpp