I am not experienced with ffmpeg. So I'm sorry if I'm asking the wrong question in the wrong place.
i am trying to make a video compressor, i add the dependency exactly like : ffmpeg_kit_flutter_full_gpl: ^4.5.1
and The code I wrote is like:
compress(path) {
FFmpegKit.executeAsync("-i $path -c:a copy -c:v libx264 -s 848x360 output.mp4", (session) async {
final returnCode = await session.getReturnCode();
if (ReturnCode.isSuccess(returnCode)){
print("işlem başarılı");
// SUCCESS
} else if (ReturnCode.isCancel(returnCode)) {
print("iptal edildi");
// CANCEL
} else {
print("hata oluştu");
print(await session.getFailStackTrace());
// ERROR
}
});
}
and im calling this method like:
asset.originFile.then((fle) {
var path = fle!.path;
compress(path);
}
);
it always returns error condition for some reason. and session.getFailStackTrace()
is null.
My first question is what do you think is wrong here?
And secondly how can I detect what the error is in such cases?
thanks in advance :)
At the end, with advice of @kesh , i used this code for see the error;
And as i figure out, if your videos name contains space or special character, FFmpeg kit gives error. So, i generate random names for input file and output file and rename them..
And if any body needs a ffmpeg video compressor, i'm leaving the code:
my depency at pubspec.yaml ;
and im generating new name like:
and my compress function is: