flutter - FFMPEG 视频不适用于社交媒体平台 (Flutter-FFMPEG)
问题描述
我正在使用Flutter-FFMPEG一个基于 Mobile FFMPEG 的 Flutter 库。我正在从 .bmp 图像列表创建视频。视频作品在 android 或桌面设备媒体播放器中正常播放。
但是当我尝试在社交媒体(比如 Instagram)上分享该视频时,它显示不支持文件格式。
它以前不能在 WhatsApp 上运行,但经过一些谷歌搜索后,我做了一些更改,它现在可以在 WhatsApp 和 Youtube 上运行,但不能在 Instagram、Linkedin 等上运行。
void _runFFmpeg() async {
print('Run FFMPEG');
var dir = await getApplicationDocumentsDirectory();
var output = await getExternalStorageDirectory();
String videoSize = '$ImageWidth:$ImageSize';
print("${ImageWidth}x$ImageSize");
var arguments = [
"-y", // replace output file if it already exists
"-i", "${output.path}/frame_%d.bmp",
"-s", '${ImageWidth}x$ImageSize',
"-framerate", "30", // framrate
"-c:v", "libvpx",
'-ab', '128k',
'-ar', '44100',
'-strict', 'experimental',
"-vcodec", "libx264",
"-pixel_format", "yuv420p",
"-preset", "ultrafast",
"-tune", "animation",
"${output.path}/test.mp4"
];
await _flutterFFmpeg.executeWithArguments(arguments).then((rc) {
print('Process done with $rc');
});
我使用的插件(Flutter-FFMPEG)不支持 libx264
我尝试使用 '
-profile:v
' 作为基线,但这给出了一个错误,说Error setting profile to baseline
.另外,我尝试先制作一个 .webm 文件,然后将其转换为 mp4。在将 .webm 转换为 mp4 时,我也能够使用 '
-profile:v
' 并且没有出错,但输出视频在社交媒体平台上不起作用。
解决方案
推荐阅读
- python - 如何控制从模块中导入哪些对象
- c# - 聚合的自定义名称
- python - 为什么在训练过程中损失曲线有很大的跳跃(上升)?
- javascript - 从页面重新加载 DIV,而不更改页面
- python - 干净地停止 QML 应用程序而不引用重复计时器
- python - python2.7-dev 不会安装
- r - R中的igraph是否可以删除不满足某些条件的子图?
- c++ - C++ CMake 项目:目标“main_app”的配方失败
- restructuredtext - reStructuredText 内联代码后跟“s”会导致“内联解释文本或短语引用起始字符串没有结束字符串。”?
- python - 如何使用 MNE 包滚动浏览 EEG 数据?