public class FFmpeg
extends java.lang.Object
Main class for FFmpeg operations. Supports synchronous execute(String...)
and
asynchronous executeAsync(String, ExecuteCallback)
methods to execute FFmpeg commands.
int rc = FFmpeg.execute("-i file1.mp4 -c:v libxvid file1.avi"); Log.i(Config.TAG, String.format("Command execution %s.", (rc == 0?"completed successfully":"failed with rc=" + rc));
long executionId = FFmpeg.executeAsync("-i file1.mp4 -c:v libxvid file1.avi", executeCallback); Log.i(Config.TAG, String.format("Asynchronous execution %d started.", executionId));
Modifier and Type | Method and Description |
---|---|
static void |
cancel()
Cancels an ongoing operation.
|
static void |
cancel(long executionId)
Cancels an ongoing operation.
|
static int |
execute(java.lang.String command)
Synchronously executes FFmpeg command provided.
|
static int |
execute(java.lang.String[] arguments)
Synchronously executes FFmpeg with arguments provided.
|
static int |
execute(java.lang.String command,
java.lang.String delimiter)
Deprecated.
argument splitting mechanism used in this method is pretty simple and prone to
errors. Consider using a more advanced method like
execute(String) or
execute(String[]) |
static long |
executeAsync(java.lang.String[] arguments,
ExecuteCallback executeCallback)
Asynchronously executes FFmpeg with arguments provided.
|
static long |
executeAsync(java.lang.String[] arguments,
ExecuteCallback executeCallback,
java.util.concurrent.Executor executor)
Asynchronously executes FFmpeg with arguments provided.
|
static long |
executeAsync(java.lang.String command,
ExecuteCallback executeCallback)
Asynchronously executes FFmpeg command provided.
|
static long |
executeAsync(java.lang.String command,
ExecuteCallback executeCallback,
java.util.concurrent.Executor executor)
Asynchronously executes FFmpeg command provided.
|
static java.util.List<FFmpegExecution> |
listExecutions()
Lists ongoing executions.
|
public static int execute(java.lang.String[] arguments)
Synchronously executes FFmpeg with arguments provided.
arguments
- FFmpeg command options/arguments as string arraypublic static long executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback)
Asynchronously executes FFmpeg with arguments provided.
arguments
- FFmpeg command options/arguments as string arrayexecuteCallback
- callback that will be notified when execution is completedpublic static long executeAsync(java.lang.String[] arguments, ExecuteCallback executeCallback, java.util.concurrent.Executor executor)
Asynchronously executes FFmpeg with arguments provided.
arguments
- FFmpeg command options/arguments as string arrayexecuteCallback
- callback that will be notified when execution is completedexecutor
- executor that will be used to run this asynchronous operationpublic static int execute(java.lang.String command, java.lang.String delimiter)
execute(String)
or
execute(String[])
Synchronously executes FFmpeg command provided. Command is split into arguments using provided delimiter character.
command
- FFmpeg commanddelimiter
- delimiter used to split argumentspublic static int execute(java.lang.String command)
Synchronously executes FFmpeg command provided. Space character is used to split command into arguments. You can use single and double quote characters to specify arguments inside your command.
command
- FFmpeg commandpublic static long executeAsync(java.lang.String command, ExecuteCallback executeCallback)
Asynchronously executes FFmpeg command provided. Space character is used to split command into arguments. You can use single and double quote characters to specify arguments inside your command.
command
- FFmpeg commandexecuteCallback
- callback that will be notified when execution is completedpublic static long executeAsync(java.lang.String command, ExecuteCallback executeCallback, java.util.concurrent.Executor executor)
Asynchronously executes FFmpeg command provided. Space character is used to split command into arguments. You can use single and double quote characters to specify arguments inside your command.
command
- FFmpeg commandexecuteCallback
- callback that will be notified when execution is completedexecutor
- executor that will be used to run this asynchronous operationpublic static void cancel()
Cancels an ongoing operation.
This function does not wait for termination to complete and returns immediately.
public static void cancel(long executionId)
Cancels an ongoing operation.
This function does not wait for termination to complete and returns immediately.
executionId
- id of the executionpublic static java.util.List<FFmpegExecution> listExecutions()
Lists ongoing executions.