Class FFprobeKit


  • public class FFprobeKit
    extends java.lang.Object

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

     FFprobeSession session = FFprobeKit.execute("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4");
    
     FFprobeSession asyncSession = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", executeCallback);
     

    Provides overloaded execute methods to define session specific callbacks.

     FFprobeSession session = FFprobeKit.executeAsync("-hide_banner -v error -show_entries format=size -of default=noprint_wrappers=1 file1.mp4", executeCallback, logCallback);
     

    It can extract media information for a file or a url, using getMediaInformation(String) method.

     MediaInformationSession session = FFprobeKit.getMediaInformation("file1.mp4");
     
    • Method Detail

      • execute

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

        Synchronously executes FFprobe with arguments provided.

        Parameters:
        arguments - FFprobe command options/arguments as string array
        Returns:
        FFprobe session created for this execution
      • executeAsync

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

        Asynchronously executes FFprobe with arguments provided.

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

        public static FFprobeSession executeAsync​(java.lang.String[] arguments,
                                                  ExecuteCallback executeCallback,
                                                  LogCallback logCallback)

        Asynchronously executes FFprobe with arguments provided.

        Parameters:
        arguments - FFprobe command options/arguments as string array
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        Returns:
        FFprobe session created for this execution
      • executeAsync

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

        Asynchronously executes FFprobe with arguments provided.

        Parameters:
        arguments - FFprobe 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:
        FFprobe session created for this execution
      • executeAsync

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

        Asynchronously executes FFprobe with arguments provided.

        Parameters:
        arguments - FFprobe command options/arguments as string array
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        executorService - executor service that will be used to run this asynchronous operation
        Returns:
        FFprobe session created for this execution
      • execute

        public static FFprobeSession execute​(java.lang.String command)

        Synchronously executes FFprobe 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 - FFprobe command
        Returns:
        FFprobe session created for this execution
      • executeAsync

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

        Asynchronously executes FFprobe 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 - FFprobe command
        executeCallback - callback that will be called when the execution is completed
        Returns:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(java.lang.String command,
                                                  ExecuteCallback executeCallback,
                                                  LogCallback logCallback)

        Asynchronously executes FFprobe 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 - FFprobe command
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        Returns:
        FFprobe session created for this execution
      • executeAsync

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

        Asynchronously executes FFprobe 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 - FFprobe 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:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(java.lang.String command,
                                                  ExecuteCallback executeCallback,
                                                  LogCallback logCallback,
                                                  java.util.concurrent.ExecutorService executorService)

        Asynchronously executes FFprobe 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 - FFprobe command
        executeCallback - callback that will be called when the execution is completed
        logCallback - callback that will receive logs
        executorService - executor service that will be used to run this asynchronous operation
        Returns:
        FFprobe session created for this execution
      • getMediaInformation

        public static MediaInformationSession getMediaInformation​(java.lang.String path)

        Extracts media information for the file specified with path.

        Parameters:
        path - path or uri of a media file
        Returns:
        media information session created for this execution
      • getMediaInformation

        public static MediaInformationSession getMediaInformation​(java.lang.String path,
                                                                  int waitTimeout)

        Extracts media information for the file specified with path.

        Parameters:
        path - path or uri of a media file
        waitTimeout - max time to wait until media information is transmitted
        Returns:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                       ExecuteCallback executeCallback)

        Extracts media information for the file specified with path asynchronously.

        Parameters:
        path - path or uri of a media file
        executeCallback - callback that will be called when the execution is completed
        Returns:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                       ExecuteCallback executeCallback,
                                                                       LogCallback logCallback,
                                                                       int waitTimeout)

        Extracts media information for the file specified with path asynchronously.

        Parameters:
        path - path or uri of a media file
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        waitTimeout - max time to wait until media information is transmitted
        Returns:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                       ExecuteCallback executeCallback,
                                                                       java.util.concurrent.ExecutorService executorService)

        Extracts media information for the file specified with path asynchronously.

        Parameters:
        path - path or uri of a media file
        executeCallback - callback that will be called when the execution is completed
        executorService - executor service that will be used to run this asynchronous operation
        Returns:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                       ExecuteCallback executeCallback,
                                                                       LogCallback logCallback,
                                                                       java.util.concurrent.ExecutorService executorService,
                                                                       int waitTimeout)

        Extracts media information for the file specified with path asynchronously.

        Parameters:
        path - path or uri of a media file
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        executorService - executor service that will be used to run this asynchronous operation
        waitTimeout - max time to wait until media information is transmitted
        Returns:
        media information session created for this execution
      • getMediaInformationFromCommand

        public static MediaInformationSession getMediaInformationFromCommand​(java.lang.String command)

        Extracts media information using the command provided asynchronously.

        Parameters:
        command - FFprobe command that prints media information for a file in JSON format
        Returns:
        media information session created for this execution
      • getMediaInformationFromCommandAsync

        public static MediaInformationSession getMediaInformationFromCommandAsync​(java.lang.String command,
                                                                                  ExecuteCallback executeCallback,
                                                                                  LogCallback logCallback,
                                                                                  int waitTimeout)

        Extracts media information using the command provided asynchronously.

        Parameters:
        command - FFprobe command that prints media information for a file in JSON format
        executeCallback - callback that will be notified when execution is completed
        logCallback - callback that will receive logs
        waitTimeout - max time to wait until media information is transmitted
        Returns:
        media information session created for this execution
      • listSessions

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

        Lists all FFprobe sessions in the session history.

        Returns:
        all FFprobe sessions in the session history