Could not crop the video with ratio height = width of device
Hi , I am trying to use this library to fix the x86 issues on Android 7. However, I have the below issue.
When tried to crop the video with this setting, it throws an error String[] cmds = new String[]{"-i", file.getAbsolutePath(), "-filter:v", "crop=out_h=in_w", croppedUrl};
Error: cropVideo:onProgress(): Failed to set value 'crop=out_h=in_w' for option 'filter:v': Option not found.
Please could you help to get this work?
That command seems to work fine for me. On what device are you testing this? Could you provide me your full code so I can reproduce this?
Thanks for the quick response @Brianvdb !! I am testing it on Emulator with Samsung S7 x86 settings. Here is the code
import nl.bravobit.ffmpeg.ExecuteBinaryResponseHandler;
import nl.bravobit.ffmpeg.FFmpeg;
public class VideoCropUtils {
private static final String TAG = "VideoCropUtils";
public static String cropVideo(Context context, final File file, final BaseCaptureInterface mBaseCaptureListener) {
FFmpeg ffmpeg = FFmpeg.getInstance(context.getApplicationContext());
String croppedUrl = file.getParent() + "/Cropped_" + file.getName();
String[] cmds = {"-i", file.getAbsolutePath(), "-vf", "crop=out_h=in_w", "-threads", "5", "-preset", "ultrafast", "-strict", "-2", croppedUrl};
if (ffmpeg.isSupported()) {
ffmpeg.execute(cmds, new ExecuteBinaryResponseHandler() {
@Override
public void onProgress(String message) {
Log.d(TAG, "cropVideo:onProgress(): " + message);
}
@Override
public void onSuccess(String message) {
file.delete();
Log.d(TAG, "cropVideo:onSuccess(): " + message);
mBaseCaptureListener.videoCropStatus(true);
}
@Override
public void onFailure(String message) {
super.onFailure(message);
Log.d(TAG, "cropVideo:onFailure(): " + message);
}
@Override
public void onFinish() {
super.onFinish();
}
});
} else {
Log.d(TAG, "FFMpeg not supported");
}
return croppedUrl;
}
}
@Brianvdb do you have any suggestions?
Your command works fine for me on x86 emulator.
Which exact ROM are you using and which Android API version?
@Brianvdb , Here are the details of emulator I'm trying on.

@Brianvdb any suggestions?