ffmpeg套件颤音视频压缩机
我没有FFMPEG的经验。因此,很抱歉,如果我在错误的地方问错误的问题。 我正在尝试制作视频压缩机,我将依赖性完全添加到:ffmpeg_kit_flutter_flutter_flutter_gl_gpl: ^4.5.1
我编写的代码就像:
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
}
});
}
,然后我称此方法为:
asset.originFile.then((fle) {
var path = fle!.path;
compress(path);
}
);
它总是出于某种原因返回错误条件。和session.getFailStackTrace()
为null。
我的第一个问题是您认为这里有什么错?
其次,在这种情况下,如何检测错误是什么?
提前致谢 :)
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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后,在@kesh的建议下,我使用了此代码来查看错误。
正如我所知道的那样,如果您的视频名称包含空间或特殊字符,则FFMPEG套件会出现错误。 文件生成随机名称,并将其重命名
。
因此,我为输入文件和输出
我生成的新名称类似:
我的压缩功能是:
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: