com.arthenica.ffmpegkit

## Class FFmpegKit

- java.lang.Object
- - com.arthenica.ffmpegkit.FFmpegKit

-     public class FFmpegKit
      extends java.lang.Object

  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", executeCallback);

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

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

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `cancel()` Cancels all running sessions.
    `static void` | `cancel(long sessionId)` Cancels the session specified with `sessionId`.
    `static FFmpegSession` | `execute(java.lang.String command)` Synchronously executes FFmpeg command provided.
    `static FFmpegSession` | `execute(java.lang.String[] arguments)` Synchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback)` Asynchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback, java.util.concurrent.ExecutorService executorService)` Asynchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)` Asynchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, java.util.concurrent.ExecutorService executorService)` Asynchronously executes FFmpeg with arguments provided.
    `static FFmpegSession` | `executeAsync(java.lang.String command, ExecuteCallback executeCallback)` Asynchronously executes FFmpeg command provided.
    `static FFmpegSession` | `executeAsync(java.lang.String command, ExecuteCallback executeCallback, java.util.concurrent.ExecutorService executorService)` Asynchronously executes FFmpeg command provided.
    `static FFmpegSession` | `executeAsync(java.lang.String command, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)` Asynchronously executes FFmpeg command provided.
    `static FFmpegSession` | `executeAsync(java.lang.String command, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, java.util.concurrent.ExecutorService executorService)` Asynchronously executes FFmpeg command provided.
    `static java.util.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

    - #### execute

          public static FFmpegSession execute(java.lang.String[] arguments)

      Synchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String[] arguments,
                                                   ExecuteCallback executeCallback)

      Asynchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `executeCallback` - callback that will be called when the execution is completed
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String[] arguments,
                                                   ExecuteCallback executeCallback,
                                                   LogCallback logCallback,
                                                   StatisticsCallback statisticsCallback)

      Asynchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `executeCallback` - callback that will be called when the execution is completed
        `logCallback` - callback that will receive logs
        `statisticsCallback` - callback that will receive statistics
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String[] arguments,
                                                   ExecuteCallback executeCallback,
                                                   java.util.concurrent.ExecutorService executorService)

      Asynchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `executeCallback` - callback that will be called when the execution is completed
        `executorService` - executor service that will be used to run this asynchronous operation
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String[] arguments,
                                                   ExecuteCallback executeCallback,
                                                   LogCallback logCallback,
                                                   StatisticsCallback statisticsCallback,
                                                   java.util.concurrent.ExecutorService executorService)

      Asynchronously executes FFmpeg with arguments provided.

      Parameters:
        `arguments` - FFmpeg command options/arguments as string array
        `executeCallback` - callback that will be called when the execution is 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
      Returns:
        FFmpeg session created for this execution

    - #### execute

          public static FFmpegSession execute(java.lang.String command)

      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

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String command,
                                                   ExecuteCallback executeCallback)

      Asynchronously 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
        `executeCallback` - callback that will be called when the execution is completed
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String command,
                                                   ExecuteCallback executeCallback,
                                                   LogCallback logCallback,
                                                   StatisticsCallback statisticsCallback)

      Asynchronously 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
        `executeCallback` - callback that will be called when the execution is completed
        `logCallback` - callback that will receive logs
        `statisticsCallback` - callback that will receive statistics
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String command,
                                                   ExecuteCallback executeCallback,
                                                   java.util.concurrent.ExecutorService executorService)

      Asynchronously 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
        `executeCallback` - callback that will be called when the execution is completed
        `executorService` - executor service that will be used to run this asynchronous operation
      Returns:
        FFmpeg session created for this execution

    - #### executeAsync

          public static FFmpegSession executeAsync(java.lang.String command,
                                                   ExecuteCallback executeCallback,
                                                   LogCallback logCallback,
                                                   StatisticsCallback statisticsCallback,
                                                   java.util.concurrent.ExecutorService executorService)

      Asynchronously 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
        `executeCallback` - callback that will be called when the execution is 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
      Returns:
        FFmpeg session created for this execution

    - #### cancel

          public static void cancel()

      Cancels all running sessions.

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

    - #### cancel

          public static void cancel(long sessionId)

      Cancels the session specified with `sessionId`.

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

      Parameters:
        `sessionId` - id of the session that will be cancelled

    - #### listSessions

          public static java.util.List<FFmpegSession> listSessions()

      Lists all FFmpeg sessions in the session history.

      Returns:
        all FFmpeg sessions in the session history