com.arthenica.ffmpegkit

## Class FFmpegKitConfig

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

-     public class FFmpegKitConfig
      extends java.lang.Object

  Configuration class of `FFmpegKit` library.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `argumentsToString(java.lang.String[] arguments)` Concatenates arguments into a string adding a space character between two arguments.
    `static void` | `asyncFFmpegExecute(FFmpegSession ffmpegSession)` Asynchronously executes the FFmpeg session provided.
    `static void` | `asyncFFmpegExecute(FFmpegSession ffmpegSession, java.util.concurrent.ExecutorService executorService)` Asynchronously executes the FFmpeg session provided.
    `static void` | `asyncFFprobeExecute(FFprobeSession ffprobeSession)` Asynchronously executes the FFprobe session provided.
    `static void` | `asyncFFprobeExecute(FFprobeSession ffprobeSession, java.util.concurrent.ExecutorService executorService)` Asynchronously executes the FFprobe session provided.
    `static void` | `asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession, java.util.concurrent.ExecutorService executorService, int waitTimeout)` Asynchronously executes the media information session provided.
    `static void` | `asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession, int waitTimeout)` Asynchronously executes the media information session provided.
    `static void` | `clearSessions()` Clears all, including ongoing, sessions in the session history.
    `static void` | `closeFFmpegPipe(java.lang.String ffmpegPipePath)` Closes a previously created `FFmpeg` pipe.
    `static void` | `disableRedirection()` Disables log and statistics redirection.
    `static void` | `enableExecuteCallback(ExecuteCallback executeCallback)` Sets a global callback function to receive execution results.
    `static void` | `enableLogCallback(LogCallback logCallback)` Sets a global callback function to redirect FFmpeg/FFprobe logs.
    `static void` | `enableRedirection()` Enables log and statistics redirection.
    `static void` | `enableStatisticsCallback(StatisticsCallback statisticsCallback)` Sets a global callback function to redirect FFmpeg statistics.
    `static void` | `ffmpegExecute(FFmpegSession ffmpegSession)` Synchronously executes the FFmpeg session provided.
    `static void` | `ffprobeExecute(FFprobeSession ffprobeSession)` Synchronously executes the FFprobe session provided.
    `static int` | `getAsyncConcurrencyLimit()` Returns the maximum number of async sessions that will be executed in parallel.
    `static java.lang.String` | `getBuildDate()` Returns FFmpegKit library build date.
    `static java.lang.String` | `getFFmpegVersion()` Returns the version of FFmpeg bundled within `FFmpegKit` library.
    `static Session` | `getLastCompletedSession()` Returns the last session completed from the session history.
    `static Session` | `getLastSession()` Returns the last session created from the session history.
    `static Level` | `getLogLevel()` Returns the current log level.
    `static LogRedirectionStrategy` | `getLogRedirectionStrategy()` Returns the active log redirection strategy.
    `static void` | `getMediaInformationExecute(MediaInformationSession mediaInformationSession, int waitTimeout)` Synchronously executes the media information session provided.
    `static java.lang.String` | `getSafParameterForRead(android.content.Context context, android.net.Uri uri)` Converts the given Structured Access Framework Uri (`"content:…"`) into an input url that can be used in FFmpeg and FFprobe commands.
    `static java.lang.String` | `getSafParameterForWrite(android.content.Context context, android.net.Uri uri)` Converts the given Structured Access Framework Uri (`"content:…"`) into an output url that can be used in FFmpeg and FFprobe commands.
    `static Session` | `getSession(long sessionId)` Returns the session specified with `sessionId` from the session history.
    `static int` | `getSessionHistorySize()` Returns the session history size.
    `static java.util.List<Session>` | `getSessions()` Returns all sessions in the session history.
    `static java.util.List<Session>` | `getSessionsByState(SessionState state)` Returns sessions that have the given state.
    `static java.util.List<java.lang.String>` | `getSupportedCameraIds(android.content.Context context)` Returns the list of camera ids supported.
    `static java.lang.String` | `getVersion()` Returns FFmpegKit library version.
    `static void` | `ignoreSignal(Signal signal)` Registers a new ignored signal.
    `static boolean` | `isLTSBuild()` Returns whether FFmpegKit release is a Long Term Release or not.
    `static int` | `messagesInTransmit(long sessionId)` Returns the number of native messages that are not transmitted to the Java callbacks for this session natively.
    `static java.lang.String[]` | `parseArguments(java.lang.String command)` Parses the given command into arguments.
    `static void` | `printToLogcat(int logPriority, java.lang.String string)` Prints the given string to Logcat using the given priority.
    `static java.lang.String` | `registerNewFFmpegPipe(android.content.Context context)` Creates a new named pipe to use in `FFmpeg` operations.
    `static void` | `setAsyncConcurrencyLimit(int asyncConcurrencyLimit)` Sets the maximum number of async sessions that will be executed in parallel.
    `static int` | `setEnvironmentVariable(java.lang.String variableName, java.lang.String variableValue)` Sets an environment variable.
    `static int` | `setFontconfigConfigurationPath(java.lang.String path)` Sets and overrides `fontconfig` configuration directory.
    `static void` | `setFontDirectory(android.content.Context context, java.lang.String fontDirectoryPath, java.util.Map<java.lang.String,java.lang.String> fontNameMapping)` Registers the fonts inside the given path, so they become available to use in FFmpeg filters.
    `static void` | `setFontDirectoryList(android.content.Context context, java.util.List<java.lang.String> fontDirectoryList, java.util.Map<java.lang.String,java.lang.String> fontNameMapping)` Registers the fonts inside the given list of font directories, so they become available to use in FFmpeg filters.
    `static void` | `setLogLevel(Level level)` Sets the log level.
    `static void` | `setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy)` Sets the log redirection strategy
    `static void` | `setSessionHistorySize(int sessionHistorySize)` Sets the session history size.

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

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

- - ### Method Detail

    - #### enableRedirection

          public static void enableRedirection()

      Enables log and statistics redirection.

      When redirection is enabled FFmpeg/FFprobe logs are redirected to Logcat and sessions collect log and statistics entries for the executions. It is possible to define global or session specific log/statistics callbacks as well.

      Note that redirection is enabled by default. If you do not want to use its functionality please use `disableRedirection()` to disable it.

    - #### disableRedirection

          public static void disableRedirection()

      Disables log and statistics redirection.

      When redirection is disabled logs are printed to stderr, all logs and statistics callbacks are disabled and `FFprobe`'s `getMediaInformation` methods do not work.

    - #### setFontconfigConfigurationPath

          public static int setFontconfigConfigurationPath(java.lang.String path)

      Sets and overrides `fontconfig` configuration directory.

      Parameters:
        `path` - directory that contains fontconfig configuration (fonts.conf)
      Returns:
        zero on success, non-zero on error

    - #### setFontDirectory

          public static void setFontDirectory(android.content.Context context,
                                              java.lang.String fontDirectoryPath,
                                              java.util.Map<java.lang.String,java.lang.String> fontNameMapping)

      Registers the fonts inside the given path, so they become available to use in FFmpeg filters.

      Note that you need to build `FFmpegKit` with `fontconfig` enabled or use a prebuilt package with `fontconfig` inside to be able to use fonts in `FFmpeg`.

      Parameters:
        `context` - application context to access application data
        `fontDirectoryPath` - directory that contains fonts (.ttf and .otf files)
        `fontNameMapping` - custom font name mappings, useful to access your fonts with more friendly names

    - #### setFontDirectoryList

          public static void setFontDirectoryList(android.content.Context context,
                                                  java.util.List<java.lang.String> fontDirectoryList,
                                                  java.util.Map<java.lang.String,java.lang.String> fontNameMapping)

      Registers the fonts inside the given list of font directories, so they become available to use in FFmpeg filters.

      Note that you need to build `FFmpegKit` with `fontconfig` enabled or use a prebuilt package with `fontconfig` inside to be able to use fonts in `FFmpeg`.

      Parameters:
        `context` - application context to access application data
        `fontDirectoryList` - list of directories that contain fonts (.ttf and .otf files)
        `fontNameMapping` - custom font name mappings, useful to access your fonts with more friendly names

    - #### registerNewFFmpegPipe

          public static java.lang.String registerNewFFmpegPipe(android.content.Context context)

      Creates a new named pipe to use in `FFmpeg` operations.

      Please note that creator is responsible of closing created pipes.

      Parameters:
        `context` - application context
      Returns:
        the full path of the named pipe

    - #### closeFFmpegPipe

          public static void closeFFmpegPipe(java.lang.String ffmpegPipePath)

      Closes a previously created `FFmpeg` pipe.

      Parameters:
        `ffmpegPipePath` - full path of the FFmpeg pipe

    - #### getSupportedCameraIds

          public static java.util.List<java.lang.String> getSupportedCameraIds(android.content.Context context)

      Returns the list of camera ids supported. These devices can be used in `FFmpeg` commands.

      Note that this method requires API Level ≥ 24. On older API levels it returns an empty list.

      Parameters:
        `context` - application context
      Returns:
        list of camera ids supported or an empty list if no supported cameras are found

    - #### getFFmpegVersion

          public static java.lang.String getFFmpegVersion()

      Returns the version of FFmpeg bundled within `FFmpegKit` library.

      Returns:
        the version of FFmpeg

    - #### getVersion

          public static java.lang.String getVersion()

      Returns FFmpegKit library version.

      Returns:
        FFmpegKit version

    - #### isLTSBuild

          public static boolean isLTSBuild()

      Returns whether FFmpegKit release is a Long Term Release or not.

      Returns:
        true/yes or false/no

    - #### getBuildDate

          public static java.lang.String getBuildDate()

      Returns FFmpegKit library build date.

      Returns:
        FFmpegKit library build date

    - #### printToLogcat

          public static void printToLogcat(int logPriority,
                                           java.lang.String string)

      Prints the given string to Logcat using the given priority. If string provided is bigger than the Logcat buffer, the string is printed in multiple lines.

      Parameters:
        `logPriority` - one of `Log.VERBOSE`, `Log.DEBUG`, `Log.INFO`, `Log.WARN`, `Log.ERROR`, `Log.ASSERT`
        `string` - string to be printed

    - #### setEnvironmentVariable

          public static int setEnvironmentVariable(java.lang.String variableName,
                                                   java.lang.String variableValue)

      Sets an environment variable.

      Parameters:
        `variableName` - environment variable name
        `variableValue` - environment variable value
      Returns:
        zero on success, non-zero on error

    - #### ignoreSignal

          public static void ignoreSignal(Signal signal)

      Registers a new ignored signal. Ignored signals are not handled by `FFmpegKit` library.

      Parameters:
        `signal` - signal to be ignored

    - #### ffmpegExecute

          public static void ffmpegExecute(FFmpegSession ffmpegSession)

      Synchronously executes the FFmpeg session provided.

      Parameters:
        `ffmpegSession` - FFmpeg session which includes command options/arguments

    - #### ffprobeExecute

          public static void ffprobeExecute(FFprobeSession ffprobeSession)

      Synchronously executes the FFprobe session provided.

      Parameters:
        `ffprobeSession` - FFprobe session which includes command options/arguments

    - #### getMediaInformationExecute

          public static void getMediaInformationExecute(MediaInformationSession mediaInformationSession,
                                                        int waitTimeout)

      Synchronously executes the media information session provided.

      Parameters:
        `mediaInformationSession` - media information session which includes command options/arguments
        `waitTimeout` - max time to wait until media information is transmitted

    - #### asyncFFmpegExecute

          public static void asyncFFmpegExecute(FFmpegSession ffmpegSession)

      Asynchronously executes the FFmpeg session provided.

      Parameters:
        `ffmpegSession` - FFmpeg session which includes command options/arguments

    - #### asyncFFmpegExecute

          public static void asyncFFmpegExecute(FFmpegSession ffmpegSession,
                                                java.util.concurrent.ExecutorService executorService)

      Asynchronously executes the FFmpeg session provided.

      Parameters:
        `ffmpegSession` - FFmpeg session which includes command options/arguments
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### asyncFFprobeExecute

          public static void asyncFFprobeExecute(FFprobeSession ffprobeSession)

      Asynchronously executes the FFprobe session provided.

      Parameters:
        `ffprobeSession` - FFprobe session which includes command options/arguments

    - #### asyncFFprobeExecute

          public static void asyncFFprobeExecute(FFprobeSession ffprobeSession,
                                                 java.util.concurrent.ExecutorService executorService)

      Asynchronously executes the FFprobe session provided.

      Parameters:
        `ffprobeSession` - FFprobe session which includes command options/arguments
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### asyncGetMediaInformationExecute

          public static void asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession,
                                                             int waitTimeout)

      Asynchronously executes the media information session provided.

      Parameters:
        `mediaInformationSession` - media information session which includes command options/arguments
        `waitTimeout` - max time to wait until media information is transmitted

    - #### asyncGetMediaInformationExecute

          public static void asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession,
                                                             java.util.concurrent.ExecutorService executorService,
                                                             int waitTimeout)

      Asynchronously executes the media information session provided.

      Parameters:
        `mediaInformationSession` - media information session which includes command options/arguments
        `executorService` - executor service that will be used to run this asynchronous operation
        `waitTimeout` - max time to wait until media information is transmitted

    - #### getAsyncConcurrencyLimit

          public static int getAsyncConcurrencyLimit()

      Returns the maximum number of async sessions that will be executed in parallel.
      Returns:
        maximum number of async sessions that will be executed in parallel

    - #### setAsyncConcurrencyLimit

          public static void setAsyncConcurrencyLimit(int asyncConcurrencyLimit)

      Sets the maximum number of async sessions that will be executed in parallel. If more sessions are submitted those will be queued.
      Parameters:
        `asyncConcurrencyLimit` - new async concurrency limit

    - #### enableLogCallback

          public static void enableLogCallback(LogCallback logCallback)

      Sets a global callback function to redirect FFmpeg/FFprobe logs.

      Parameters:
        `logCallback` - log callback function or null to disable a previously defined callback

    - #### enableStatisticsCallback

          public static void enableStatisticsCallback(StatisticsCallback statisticsCallback)

      Sets a global callback function to redirect FFmpeg statistics.

      Parameters:
        `statisticsCallback` - statistics callback function or null to disable a previously defined callback

    - #### enableExecuteCallback

          public static void enableExecuteCallback(ExecuteCallback executeCallback)

      Sets a global callback function to receive execution results.

      Parameters:
        `executeCallback` - execute callback function or null to disable a previously defined callback

    - #### getLogLevel

          public static Level getLogLevel()

      Returns the current log level.
      Returns:
        current log level

    - #### setLogLevel

          public static void setLogLevel(Level level)

      Sets the log level.
      Parameters:
        `level` - new log level

    - #### getSafParameterForRead

          public static java.lang.String getSafParameterForRead(android.content.Context context,
                                                                android.net.Uri uri)

      Converts the given Structured Access Framework Uri (`"content:…"`) into an input url that can be used in FFmpeg and FFprobe commands.

      Requires API Level ≥ 19. On older API levels it returns an empty url.

      Parameters:
        `context` - application context
        `uri` - saf uri
      Returns:
        input url that can be passed to FFmpegKit or FFprobeKit

    - #### getSafParameterForWrite

          public static java.lang.String getSafParameterForWrite(android.content.Context context,
                                                                 android.net.Uri uri)

      Converts the given Structured Access Framework Uri (`"content:…"`) into an output url that can be used in FFmpeg and FFprobe commands.

      Requires API Level ≥ 19. On older API levels it returns an empty url.

      Parameters:
        `context` - application context
        `uri` - saf uri
      Returns:
        output url that can be passed to FFmpegKit or FFprobeKit

    - #### getSessionHistorySize

          public static int getSessionHistorySize()

      Returns the session history size.
      Returns:
        session history size

    - #### setSessionHistorySize

          public static void setSessionHistorySize(int sessionHistorySize)

      Sets the session history size.
      Parameters:
        `sessionHistorySize` - session history size, should be smaller than 1000

    - #### getSession

          public static Session getSession(long sessionId)

      Returns the session specified with `sessionId` from the session history.
      Parameters:
        `sessionId` - session identifier
      Returns:
        session specified with sessionId or null if it is not found in the history

    - #### getLastSession

          public static Session getLastSession()

      Returns the last session created from the session history.
      Returns:
        the last session created or null if session history is empty

    - #### getLastCompletedSession

          public static Session getLastCompletedSession()

      Returns the last session completed from the session history.
      Returns:
        the last session completed. If there are no completed sessions in the history this method will return null

    - #### getSessions

          public static java.util.List<Session> getSessions()

      Returns all sessions in the session history.

      Returns:
        all sessions in the session history

    - #### clearSessions

          public static void clearSessions()

      Clears all, including ongoing, sessions in the session history.

      Note that callbacks cannot be triggered for deleted sessions.

    - #### getSessionsByState

          public static java.util.List<Session> getSessionsByState(SessionState state)

      Returns sessions that have the given state.

      Parameters:
        `state` - session state
      Returns:
        sessions that have the given state from the session history

    - #### getLogRedirectionStrategy

          public static LogRedirectionStrategy getLogRedirectionStrategy()

      Returns the active log redirection strategy.
      Returns:
        log redirection strategy

    - #### setLogRedirectionStrategy

          public static void setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy)

      Sets the log redirection strategy

      Parameters:
        `logRedirectionStrategy` - log redirection strategy

    - #### parseArguments

          public static java.lang.String[] parseArguments(java.lang.String command)

      Parses the given command into arguments. Uses space character to split the arguments. Supports single and double quote characters.

      Parameters:
        `command` - string command
      Returns:
        array of arguments

    - #### argumentsToString

          public static java.lang.String argumentsToString(java.lang.String[] arguments)

      Concatenates arguments into a string adding a space character between two arguments.

      Parameters:
        `arguments` - arguments
      Returns:
        concatenated string containing all arguments

    - #### messagesInTransmit

          public static int messagesInTransmit(long sessionId)

      Returns the number of native messages that are not transmitted to the Java callbacks for this session natively.

      Parameters:
        `sessionId` - id of the session
      Returns:
        number of native messages that are not transmitted to the Java callbacks for this session natively