FFMPEG 视频不适用于社交媒体平台 (Flutter-FFMPEG)

问题描述

我正在使用 Flutter-FFMPEG 一个基于 Mobile FFMPEG 的 Flutter 库。我正在从 .bmp 图像列表创建视频。视频作品在安卓或桌面设备的媒体播放器中正常播放。

但是当我尝试在社交媒体上分享该视频时,比如 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”,并且没有出现错误,但输出视频在社交媒体平台上不起作用。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)