# FFmpegKitConfig

Package

## Class FFmpegKitConfig

-     public class FFmpegKitConfig

  Configuration class of `FFmpegKit` library.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `private static int` | `sessionHistorySize` |
    `private static int` | `asyncConcurrencyLimit` |

  - ### Method Summary

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

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

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

- - ### Method Detail

    - #### getSessionHistorySize

           static int getSessionHistorySize()

      Returns the session history size.

    - #### setSessionHistorySize

           static void setSessionHistorySize(int sessionHistorySize)

      Sets the session history size.

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

    - #### getAsyncConcurrencyLimit

           static int getAsyncConcurrencyLimit()

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

    - #### setAsyncConcurrencyLimit

           static void setAsyncConcurrencyLimit(int asyncConcurrencyLimit)

      Sets the maximum number of async sessions that will be executed in parallel. If moresessions are submitted those will be queued.

      Parameters:
        `asyncConcurrencyLimit` - new async concurrency limit

    - #### enableRedirection

           static void enableRedirection()

      Enables log and statistics redirection.

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

      Note that redirection is enabled by default. If you do not want to use its functionalityplease use disableRedirection to disable it.

    - #### disableRedirection

           static void disableRedirection()

      Disables log and statistics redirection.

      When redirection is disabled logs are printed to stderr, all logs and statisticscallbacks are disabled and `FFprobe`'s `getMediaInformation` methodsdo not work.

    - #### setFontconfigConfigurationPath

           static int setFontconfigConfigurationPath(String path)

      Sets and overrides `fontconfig` configuration directory.

      Parameters:
        `path` - directory that contains fontconfig configuration (fonts.

    - #### setFontDirectory

           static void setFontDirectory(Context context, String fontDirectoryPath, Map<String, String> fontNameMapping)

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

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

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

    - #### setFontDirectoryList

           static void setFontDirectoryList(Context context, List<String> fontDirectoryList, Map<String, String> fontNameMapping)

      Registers the fonts inside the given list of font directories, so they become availableto 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 usefonts in `FFmpeg`.

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

    - #### registerNewFFmpegPipe

           static String registerNewFFmpegPipe(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

    - #### closeFFmpegPipe

           static void closeFFmpegPipe(String ffmpegPipePath)

      Closes a previously created `FFmpeg` pipe.

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

    - #### getSupportedCameraIds

           static List<String> getSupportedCameraIds(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 emptylist.

      Parameters:
        `context` - application context

    - #### getFFmpegVersion

           static String getFFmpegVersion()

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

    - #### getVersion

           static String getVersion()

      Returns FFmpegKit library version.

    - #### isLTSBuild

           static boolean isLTSBuild()

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

    - #### getBuildDate

           static String getBuildDate()

      Returns FFmpegKit library build date.

    - #### printToLogcat

           static void printToLogcat(int logPriority, String string)

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

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

    - #### setEnvironmentVariable

           static int setEnvironmentVariable(String variableName, String variableValue)

      Sets an environment variable.

      Parameters:
        `variableName` - environment variable name
        `variableValue` - environment variable value

    - #### ignoreSignal

           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

           static void ffmpegExecute(FFmpegSession ffmpegSession)

      Synchronously executes the FFmpeg session provided.

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

    - #### ffprobeExecute

           static void ffprobeExecute(FFprobeSession ffprobeSession)

      Synchronously executes the FFprobe session provided.

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

    - #### getMediaInformationExecute

           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

           static void asyncFFmpegExecute(FFmpegSession ffmpegSession)

      Starts an asynchronous FFmpeg execution for the given session.

      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:
        `ffmpegSession` - FFmpeg session which includes command options/arguments

    - #### asyncFFmpegExecute

           static void asyncFFmpegExecute(FFmpegSession ffmpegSession, ExecutorService executorService)

      Starts an asynchronous FFmpeg execution for the given session.

      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:
        `ffmpegSession` - FFmpeg session which includes command options/arguments
        `executorService` - executor service that will be used to run this asynchronous operation

    - #### asyncFFprobeExecute

           static void asyncFFprobeExecute(FFprobeSession ffprobeSession)

      Starts an asynchronous FFprobe execution for the given session.

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

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

    - #### asyncFFprobeExecute

           static void asyncFFprobeExecute(FFprobeSession ffprobeSession, ExecutorService executorService)

      Starts an asynchronous FFprobe execution for the given session.

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

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

    - #### asyncGetMediaInformationExecute

           static void asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession, int waitTimeout)

      Starts an asynchronous FFprobe execution for the given media information session.

      Note that this method returns immediately and does not wait the execution to complete.You must use a MediaInformationSessionCompleteCallback if you want to be notifiedabout the result.

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

    - #### asyncGetMediaInformationExecute

           static void asyncGetMediaInformationExecute(MediaInformationSession mediaInformationSession, ExecutorService executorService, int waitTimeout)

      Starts an asynchronous FFprobe execution for the given media information session.

      Note that this method returns immediately and does not wait the execution to complete.You must use a MediaInformationSessionCompleteCallback if you want to be notifiedabout the result.

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

    - #### enableLogCallback

           static void enableLogCallback(LogCallback logCallback)

      Sets a global callback to redirect FFmpeg/FFprobe logs.

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

    - #### enableStatisticsCallback

           static void enableStatisticsCallback(StatisticsCallback statisticsCallback)

      Sets a global callback to redirect FFmpeg statistics.

      Parameters:
        `statisticsCallback` - statistics callback or null to disable a previouslydefined callback

    - #### enableFFmpegSessionCompleteCallback

           static void enableFFmpegSessionCompleteCallback(FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback)

      Sets a global FFmpegSessionCompleteCallback to receive execution results for FFmpegsessions.

      Parameters:
        `ffmpegSessionCompleteCallback` - complete callback or null to disable apreviously defined callback

    - #### getFFmpegSessionCompleteCallback

           static FFmpegSessionCompleteCallback getFFmpegSessionCompleteCallback()

      Returns the global FFmpegSessionCompleteCallback set.

    - #### enableFFprobeSessionCompleteCallback

           static void enableFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback)

      Sets a global FFprobeSessionCompleteCallback to receive execution results for FFprobesessions.

      Parameters:
        `ffprobeSessionCompleteCallback` - complete callback or null to disable apreviously defined callback

    - #### getFFprobeSessionCompleteCallback

           static FFprobeSessionCompleteCallback getFFprobeSessionCompleteCallback()

      Returns the global FFprobeSessionCompleteCallback set.

    - #### enableMediaInformationSessionCompleteCallback

           static void enableMediaInformationSessionCompleteCallback(MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback)

      Sets a global MediaInformationSessionCompleteCallback to receive execution results forMediaInformation sessions.

      Parameters:
        `mediaInformationSessionCompleteCallback` - complete callback or null to disablea previously defined callback

    - #### getMediaInformationSessionCompleteCallback

           static MediaInformationSessionCompleteCallback getMediaInformationSessionCompleteCallback()

      Returns the global MediaInformationSessionCompleteCallback set.

    - #### getLogLevel

           static Level getLogLevel()

      Returns the current log level.

    - #### setLogLevel

           static void setLogLevel(Level level)

      Sets the log level.

      Parameters:
        `level` - new log level

    - #### getSafParameter

           static String getSafParameter(Context context, Uri uri, String openMode)

      Converts the given Structured Access Framework Uri (`"content:…"`) into anSAF protocol 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
        `openMode` - file mode to use as defined in ContentProvider.

    - #### getSafParameterForRead

           static String getSafParameterForRead(Context context, Uri uri)

      Converts the given Structured Access Framework Uri (`"content:…"`) into anSAF protocol 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

    - #### getSafParameterForWrite

           static String getSafParameterForWrite(Context context, Uri uri)

      Converts the given Structured Access Framework Uri (`"content:…"`) into anSAF protocol 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

    - #### getSession

           static Session getSession(long sessionId)

      Returns the session specified with `sessionId` from the session history.

      Parameters:
        `sessionId` - session identifier

    - #### getLastSession

           static Session getLastSession()

      Returns the last session created from the session history.

    - #### getLastCompletedSession

           static Session getLastCompletedSession()

      Returns the last session completed from the session history.

    - #### getSessions

           static List<Session> getSessions()

      Returns all sessions in the session history.

    - #### clearSessions

           static void clearSessions()

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

      Note that callbacks cannot be triggered for deleted sessions.

    - #### getFFmpegSessions

           static List<FFmpegSession> getFFmpegSessions()

      Returns all FFmpeg sessions in the session history.

    - #### getFFprobeSessions

           static List<FFprobeSession> getFFprobeSessions()

      Returns all FFprobe sessions in the session history.

    - #### getMediaInformationSessions

           static List<MediaInformationSession> getMediaInformationSessions()

      Returns all MediaInformation sessions in the session history.

    - #### getSessionsByState

           static List<Session> getSessionsByState(SessionState state)

      Returns sessions that have the given state.

      Parameters:
        `state` - session state

    - #### getLogRedirectionStrategy

           static LogRedirectionStrategy getLogRedirectionStrategy()

      Returns the active log redirection strategy.

    - #### setLogRedirectionStrategy

           static void setLogRedirectionStrategy(LogRedirectionStrategy logRedirectionStrategy)

      Sets the log redirection strategy

      Parameters:
        `logRedirectionStrategy` - log redirection strategy

    - #### sessionStateToString

           static String sessionStateToString(SessionState state)

      Converts session state to string.

      Parameters:
        `state` - session state

    - #### parseArguments

           static Array<String> parseArguments(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

    - #### argumentsToString

           static String argumentsToString(Array<String> arguments)

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

      Parameters:
        `arguments` - arguments

    - #### messagesInTransmit

           static native int messagesInTransmit(long sessionId)

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

      Parameters:
        `sessionId` - id of the session