# FFprobeKit (FFmpegKit)

Package com.arthenica.ffmpegkit

## Class FFprobeKit

- java.lang.Object
- - com.arthenica.ffmpegkit.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", completeCallback);

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", completeCallback, logCallback);

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

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

### Method Summary

All Methods Static Methods Concrete Methods
`static FFprobeSession` `execute​(java.lang.String command)` Synchronously executes FFprobe command provided.
`static FFprobeSession` `executeAsync​(java.lang.String command, FFprobeSessionCompleteCallback completeCallback)` Starts an asynchronous FFprobe execution for the given command.
`static FFprobeSession` `executeAsync​(java.lang.String command, FFprobeSessionCompleteCallback completeCallback, LogCallback logCallback)` Starts an asynchronous FFprobe execution for the given command.
`static FFprobeSession` `executeAsync​(java.lang.String command, FFprobeSessionCompleteCallback completeCallback, LogCallback logCallback, java.util.concurrent.ExecutorService executorService)` Starts an asynchronous FFprobe execution for the given command.
`static FFprobeSession` `executeAsync​(java.lang.String command, FFprobeSessionCompleteCallback completeCallback, java.util.concurrent.ExecutorService executorService)` Starts an asynchronous FFprobe execution for the given command.
`static FFprobeSession` `executeWithArguments​(java.lang.String[] arguments)` Synchronously executes FFprobe with arguments provided.
`static FFprobeSession` `executeWithArgumentsAsync​(java.lang.String[] arguments, FFprobeSessionCompleteCallback completeCallback)` Starts an asynchronous FFprobe execution with arguments provided.
`static FFprobeSession` `executeWithArgumentsAsync​(java.lang.String[] arguments, FFprobeSessionCompleteCallback completeCallback, LogCallback logCallback)` Starts an asynchronous FFprobe execution with arguments provided.
`static FFprobeSession` `executeWithArgumentsAsync​(java.lang.String[] arguments, FFprobeSessionCompleteCallback completeCallback, LogCallback logCallback, java.util.concurrent.ExecutorService executorService)` Starts an asynchronous FFprobe execution with arguments provided.
`static FFprobeSession` `executeWithArgumentsAsync​(java.lang.String[] arguments, FFprobeSessionCompleteCallback completeCallback, java.util.concurrent.ExecutorService executorService)` Starts an asynchronous FFprobe execution with arguments provided.
`static MediaInformationSession` `getMediaInformation​(java.lang.String path)` Extracts media information for the file specified with path.
`static MediaInformationSession` `getMediaInformation​(java.lang.String path, int waitTimeout)` Extracts media information for the file specified with path.
`static MediaInformationSession` `getMediaInformationAsync​(java.lang.String path, MediaInformationSessionCompleteCallback completeCallback)` Starts an asynchronous FFprobe execution to extract the media information for the specified file.
`static MediaInformationSession` `getMediaInformationAsync​(java.lang.String path, MediaInformationSessionCompleteCallback completeCallback, LogCallback logCallback, int waitTimeout)` Starts an asynchronous FFprobe execution to extract the media information for the specified file.
`static MediaInformationSession` `getMediaInformationAsync​(java.lang.String path, MediaInformationSessionCompleteCallback completeCallback, LogCallback logCallback, java.util.concurrent.ExecutorService executorService, int waitTimeout)` Starts an asynchronous FFprobe execution to extract the media information for the specified file.
`static MediaInformationSession` `getMediaInformationAsync​(java.lang.String path, MediaInformationSessionCompleteCallback completeCallback, java.util.concurrent.ExecutorService executorService)` Starts an asynchronous FFprobe execution to extract the media information for the specified file.
`static MediaInformationSession` `getMediaInformationFromCommand​(java.lang.String command)` Extracts media information using the command provided.
`static MediaInformationSession` `getMediaInformationFromCommandAsync​(java.lang.String command, MediaInformationSessionCompleteCallback completeCallback, LogCallback logCallback, int waitTimeout)` Starts an asynchronous FFprobe execution to extract media information using a command.
`static java.util.List<FFprobeSession>` `listFFprobeSessions()` Lists all FFprobe sessions in the session history.
`static java.util.List<MediaInformationSession>` `listMediaInformationSessions()` Lists all MediaInformation sessions in the session history.

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

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

### Method Detail

#### executeWithArguments

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

#### executeWithArgumentsAsync

    public static FFprobeSession executeWithArgumentsAsync​(java.lang.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.

Parameters:
  `arguments` - FFprobe command options/arguments as string array
  `completeCallback` - callback that will be called when the execution has completed
Returns:
  FFprobe session created for this execution

#### executeWithArgumentsAsync

    public static FFprobeSession executeWithArgumentsAsync​(java.lang.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.

Parameters:
  `arguments` - FFprobe command options/arguments as string array
  `completeCallback` - callback that will be notified when execution has completed
  `logCallback` - callback that will receive logs
Returns:
  FFprobe session created for this execution

#### executeWithArgumentsAsync

    public static FFprobeSession executeWithArgumentsAsync​(java.lang.String[] arguments,
                                                           FFprobeSessionCompleteCallback completeCallback,
                                                           java.util.concurrent.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.

Parameters:
  `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
Returns:
  FFprobe session created for this execution

#### executeWithArgumentsAsync

    public static FFprobeSession executeWithArgumentsAsync​(java.lang.String[] arguments,
                                                           FFprobeSessionCompleteCallback completeCallback,
                                                           LogCallback logCallback,
                                                           java.util.concurrent.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.

Parameters:
  `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
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,
                                              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.

Parameters:
  `command` - FFprobe command
  `completeCallback` - callback that will be called when the execution has completed
Returns:
  FFprobe session created for this execution

#### executeAsync

    public static FFprobeSession executeAsync​(java.lang.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.

Parameters:
  `command` - FFprobe command
  `completeCallback` - callback that will be notified when execution has completed
  `logCallback` - callback that will receive logs
Returns:
  FFprobe session created for this execution

#### executeAsync

    public static FFprobeSession executeAsync​(java.lang.String command,
                                              FFprobeSessionCompleteCallback completeCallback,
                                              java.util.concurrent.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.

Parameters:
  `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
Returns:
  FFprobe session created for this execution

#### executeAsync

    public static FFprobeSession executeAsync​(java.lang.String command,
                                              FFprobeSessionCompleteCallback completeCallback,
                                              LogCallback logCallback,
                                              java.util.concurrent.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.

Parameters:
  `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
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,
                                                                   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.

Parameters:
  `path` - path or uri of a media file
  `completeCallback` - callback that will be called when the execution has completed
Returns:
  media information session created for this execution

#### getMediaInformationAsync

    public static MediaInformationSession getMediaInformationAsync​(java.lang.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.

Parameters:
  `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
Returns:
  media information session created for this execution

#### getMediaInformationAsync

    public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                   MediaInformationSessionCompleteCallback completeCallback,
                                                                   java.util.concurrent.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.

Parameters:
  `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
Returns:
  media information session created for this execution

#### getMediaInformationAsync

    public static MediaInformationSession getMediaInformationAsync​(java.lang.String path,
                                                                   MediaInformationSessionCompleteCallback completeCallback,
                                                                   LogCallback logCallback,
                                                                   java.util.concurrent.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.

Parameters:
  `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
Returns:
  media information session created for this execution

#### getMediaInformationFromCommand

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

Extracts media information using the command provided.

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

Parameters:
  `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
Returns:
  media information session created for this execution

#### listFFprobeSessions

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

Lists all FFprobe sessions in the session history.

Returns:
  all FFprobe sessions in the session history

#### listMediaInformationSessions

    public static java.util.List<MediaInformationSession> listMediaInformationSessions()

Lists all MediaInformation sessions in the session history.

Returns:
  all MediaInformation sessions in the session history