类 FFprobeKit


  • public class FFprobeKit
    extends Object
    运行 FFprobe 命令的main class。支持 synchronously 和 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", completeCallback);
     

    提供 overloaded 重载 execute 方法来指定 callbacks

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

    使用 getMediaInformation(String) 从一个文件或者 url 里提取media information

     MediaInformationSession session = FFprobeKit.getMediaInformation("file1.mp4");
     
    作者:
    Li Junchao
    • 方法详细资料

      • executeWithArguments

        public static FFprobeSession executeWithArguments​(String[] arguments)

        Synchronously executes FFprobe with arguments provided.

        参数:
        arguments - FFprobe command options/arguments as string array
        返回:
        FFprobe session created for this execution
      • executeWithArgumentsAsync

        public static FFprobeSession executeWithArgumentsAsync​(String[] arguments,
                                                               FFprobeSessionCompleteCallback completeCallback)

        Starts an asynchronous FFprobe execution with arguments provided.

        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 the result.

        参数:
        arguments - FFprobe command options/arguments as string array
        completeCallback - callback that will be called when the execution has completed
        返回:
        FFprobe session created for this execution
      • executeWithArgumentsAsync

        public static FFprobeSession executeWithArgumentsAsync​(String[] arguments,
                                                               FFprobeSessionCompleteCallback completeCallback,
                                                               LogCallback logCallback)

        Starts an asynchronous FFprobe execution with arguments provided.

        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 the result.

        参数:
        arguments - FFprobe command options/arguments as string array
        completeCallback - callback that will be notified when execution has completed
        logCallback - callback that will receive logs
        返回:
        FFprobe session created for this execution
      • executeWithArgumentsAsync

        public static FFprobeSession executeWithArgumentsAsync​(String[] arguments,
                                                               FFprobeSessionCompleteCallback completeCallback,
                                                               ExecutorService executorService)

        Starts an asynchronous FFprobe execution with arguments provided.

        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 the result.

        参数:
        arguments - FFprobe command options/arguments as string array
        completeCallback - callback that will be called when the execution has completed
        executorService - executor service that will be used to run this asynchronous operation
        返回:
        FFprobe session created for this execution
      • executeWithArgumentsAsync

        public static FFprobeSession executeWithArgumentsAsync​(String[] arguments,
                                                               FFprobeSessionCompleteCallback completeCallback,
                                                               LogCallback logCallback,
                                                               ExecutorService executorService)

        Starts an asynchronous FFprobe execution with arguments provided.

        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 the result.

        参数:
        arguments - FFprobe command options/arguments as string array
        completeCallback - callback that will be notified when execution has completed
        logCallback - callback that will receive logs
        executorService - executor service that will be used to run this asynchronous operation
        返回:
        FFprobe session created for this execution
      • execute

        public static FFprobeSession execute​(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.

        参数:
        command - FFprobe command
        返回:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(String command,
                                                  FFprobeSessionCompleteCallback completeCallback)

        Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

        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 the result.

        参数:
        command - FFprobe command
        completeCallback - callback that will be called when the execution has completed
        返回:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(String command,
                                                  FFprobeSessionCompleteCallback completeCallback,
                                                  LogCallback logCallback)

        Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

        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 the result.

        参数:
        command - FFprobe command
        completeCallback - callback that will be notified when execution has completed
        logCallback - callback that will receive logs
        返回:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(String command,
                                                  FFprobeSessionCompleteCallback completeCallback,
                                                  ExecutorService executorService)

        Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

        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 the result.

        参数:
        command - FFprobe command
        completeCallback - callback that will be called when the execution has completed
        executorService - executor service that will be used to run this asynchronous operation
        返回:
        FFprobe session created for this execution
      • executeAsync

        public static FFprobeSession executeAsync​(String command,
                                                  FFprobeSessionCompleteCallback completeCallback,
                                                  LogCallback logCallback,
                                                  ExecutorService executorService)

        Starts an asynchronous FFprobe execution for the given command. Space character is used to split the command into arguments. You can use single or double quote characters to specify arguments inside your command.

        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 the result.

        参数:
        command - FFprobe command
        completeCallback - callback that will be called when the execution has completed
        logCallback - callback that will receive logs
        executorService - executor service that will be used to run this asynchronous operation
        返回:
        FFprobe session created for this execution
      • getMediaInformation

        public static MediaInformationSession getMediaInformation​(String path)

        Extracts media information for the file specified with path.

        参数:
        path - path or uri of a media file
        返回:
        media information session created for this execution
      • getMediaInformation

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

        Extracts media information for the file specified with path.

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

        public static MediaInformationSession getMediaInformationAsync​(String path,
                                                                       MediaInformationSessionCompleteCallback completeCallback)

        Starts an asynchronous FFprobe execution to extract the media information for the specified file.

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

        参数:
        path - path or uri of a media file
        completeCallback - callback that will be called when the execution has completed
        返回:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(String path,
                                                                       MediaInformationSessionCompleteCallback completeCallback,
                                                                       LogCallback logCallback,
                                                                       int waitTimeout)

        Starts an asynchronous FFprobe execution to extract the media information for the specified file.

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

        参数:
        path - path or uri of a media file
        completeCallback - callback that will be notified when execution has completed
        logCallback - callback that will receive logs
        waitTimeout - max time to wait until media information is transmitted
        返回:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(String path,
                                                                       MediaInformationSessionCompleteCallback completeCallback,
                                                                       ExecutorService executorService)

        Starts an asynchronous FFprobe execution to extract the media information for the specified file.

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

        参数:
        path - path or uri of a media file
        completeCallback - callback that will be called when the execution has completed
        executorService - executor service that will be used to run this asynchronous operation
        返回:
        media information session created for this execution
      • getMediaInformationAsync

        public static MediaInformationSession getMediaInformationAsync​(String path,
                                                                       MediaInformationSessionCompleteCallback completeCallback,
                                                                       LogCallback logCallback,
                                                                       ExecutorService executorService,
                                                                       int waitTimeout)

        Starts an asynchronous FFprobe execution to extract the media information for the specified file.

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

        参数:
        path - path or uri of a media file
        completeCallback - callback that will be notified when execution has 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
        返回:
        media information session created for this execution
      • getMediaInformationFromCommand

        public static MediaInformationSession getMediaInformationFromCommand​(String command)

        Extracts media information using the command provided.

        参数:
        command - FFprobe command that prints media information for a file in JSON format
        返回:
        media information session created for this execution
      • getMediaInformationFromCommandAsync

        public static MediaInformationSession getMediaInformationFromCommandAsync​(String command,
                                                                                  MediaInformationSessionCompleteCallback completeCallback,
                                                                                  LogCallback logCallback,
                                                                                  int waitTimeout)

        Starts an asynchronous FFprobe execution to extract media information using a command. The command passed to this method must generate the output in JSON format in order to successfully extract media information from it.

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

        参数:
        command - FFprobe command that prints media information for a file in JSON format
        completeCallback - callback that will be notified when execution has completed
        logCallback - callback that will receive logs
        waitTimeout - max time to wait until media information is transmitted
        返回:
        media information session created for this execution
      • listFFprobeSessions

        public static List<FFprobeSession> listFFprobeSessions()

        Lists all FFprobe sessions in the session history.

        返回:
        all FFprobe sessions in the session history
      • listMediaInformationSessions

        public static List<MediaInformationSession> listMediaInformationSessions()

        Lists all MediaInformation sessions in the session history.

        返回:
        all MediaInformation sessions in the session history