# FFmpegKit

Package

## Class FFmpegKit

-     public class FFmpegKit

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

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

      FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", completeCallback);

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

      FFmpegSession asyncSession = FFmpegKit.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", completeCallback, logCallback, statisticsCallback);

- - ### Method Summary

    Modifier and Type | Method | Description
    --- | --- | ---
    `static FFmpegSession` | `executeWithArguments(Array<String> arguments)` | Synchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback)` | Starts an asynchronous FFmpeg execution with arguments provided.
    `static FFmpegSession` | `executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)` | Starts an asynchronous FFmpeg execution with arguments provided.
    `static FFmpegSession` | `executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, ExecutorService executorService)` | Starts an asynchronous FFmpeg execution with arguments provided.
    `static FFmpegSession` | `executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, ExecutorService executorService)` | Starts an asynchronous FFmpeg execution with arguments provided.
    `static FFmpegSession` | `execute(String command)` | Synchronously executes FFmpeg command provided.
    `static FFmpegSession` | `executeAsync(String command, FFmpegSessionCompleteCallback completeCallback)` | Starts an asynchronous FFmpeg execution for the given command.
    `static FFmpegSession` | `executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)` | Starts an asynchronous FFmpeg execution for the given command.
    `static FFmpegSession` | `executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, ExecutorService executorService)` | Starts an asynchronous FFmpeg execution for the given command.
    `static FFmpegSession` | `executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, ExecutorService executorService)` | Starts an asynchronous FFmpeg execution for the given command.
    `static void` | `cancel()` | Cancels all running sessions.
    `static void` | `cancel(long sessionId)` | Cancels the session specified with `sessionId`.
    `static List<FFmpegSession>` | `listSessions()` | Lists all FFmpeg sessions in the session history.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### executeWithArguments

           static FFmpegSession executeWithArguments(Array<String> arguments)

      Synchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array

    - #### executeWithArgumentsAsync

           static FFmpegSession executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback)

      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 theresult.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `completeCallback` - callback that will be called when the execution has completed

    - #### executeWithArgumentsAsync

           static FFmpegSession executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)

      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 theresult.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `completeCallback` - callback that will be called when the execution has completed
        `logCallback` - callback that will receive logs
        `statisticsCallback` - callback that will receive statistics

    - #### executeWithArgumentsAsync

           static FFmpegSession executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, ExecutorService executorService)

      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 theresult.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `completeCallback` - callback that will be called when the execution has completed
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### executeWithArgumentsAsync

           static FFmpegSession executeWithArgumentsAsync(Array<String> arguments, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, ExecutorService executorService)

      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 theresult.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `completeCallback` - callback that will be called when the execution has completed
        `logCallback` - callback that will receive logs
        `statisticsCallback` - callback that will receive statistics
        `executorService` - executor service that will be used to run this asynchronousoperation

    - #### execute

           static FFmpegSession execute(String command)

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

      Parameters:
        `command` - FFmpeg command

    - #### executeAsync

           static FFmpegSession executeAsync(String command, FFmpegSessionCompleteCallback completeCallback)

      Starts an asynchronous FFmpeg execution for the given command. Space character is used tosplit the command into arguments. You can use single or double quote characters to specifyarguments 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 theresult.

      Parameters:
        `command` - FFmpeg command
        `completeCallback` - callback that will be called when the execution has completed

    - #### executeAsync

           static FFmpegSession executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)

      Starts an asynchronous FFmpeg execution for the given command. Space character is used tosplit the command into arguments. You can use single or double quote characters to specifyarguments 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 theresult.

      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

    - #### executeAsync

           static FFmpegSession executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, ExecutorService executorService)

      Starts an asynchronous FFmpeg execution for the given command. Space character is used tosplit the command into arguments. You can use single or double quote characters to specifyarguments 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 theresult.

      Parameters:
        `command` - FFmpeg command
        `completeCallback` - callback that will be called when the execution has completed
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### executeAsync

           static FFmpegSession executeAsync(String command, FFmpegSessionCompleteCallback completeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, ExecutorService executorService)

      Starts an asynchronous FFmpeg execution for the given command. Space character is used tosplit the command into arguments. You can use single or double quote characters to specifyarguments 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 theresult.

      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
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### cancel

           static void cancel()

      Cancels all running sessions.

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

    - #### cancel

           static void cancel(long sessionId)

      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

    - #### listSessions

           static List<FFmpegSession> listSessions()

      Lists all FFmpeg sessions in the session history.