Package 

Class FFmpegKitConfig

    • Method Detail

      • 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 fontconfigenabled 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 fontconfigenabled 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 FFmpegcommands.

        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.

      • isLTSBuild

         static boolean isLTSBuild()

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

      • 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 FFmpegKitlibrary.

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

      • clearSessions

         static void clearSessions()

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

        Note that callbacks cannot be triggered for deleted sessions.

      • 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