我想找到视频文件的持续时间。为此,我使用了以下命令。 它是Desktop中的工作文件。在android中运行时显示错误。我还附上错误消息。谁能告诉我为什么它不起作用?
execFFmpegBinary("-i "+file.getAbsolutePath()+" 2>&1 | find \"Duration\"");
//Function used to run command
private static void execFFmpegBinary(final String command)
{
try
{
ffmpeg.execute(command, new ExecuteBinaryResponseHandler()
{
@Override
public void onFailure(String s)
{
Log.d(TAG, "FAILED with output : " + s);
}
@Override
public void onSuccess(String s)
{
Log.d(TAG, "SUCCESS with output : " + s);
}
@Override
public void onProgress(String s)
{
Log.d(TAG, "Started command : ffmpeg " + command);
Log.d(TAG, "progress : " + s);
}
@Override
public void onStart()
{
Log.d(TAG, "Started command : ffmpeg " + command);
}
@Override
public void onFinish()
{
Log.d(TAG, "Finished command : ffmpeg " + command);
}
});
}
catch (FFmpegCommandAlreadyRunningException e)
{
// do nothing for now
Log.i(TAG,"Command Already running");
}
}
错误消息:
[NULL @ 0xac11acd0] Unable to find a suitable output format for '2>&1'
2>&1: Invalid argument