视频编辑器

FLUTTER API:视频编辑器允许使用超灵活的 UI 设计来修剪、裁剪、旋转和缩放视频。

特点

  • 超灵活的UI设计。
  • 支持的操作
    • 裁剪
    • 剪辑
    • 缩放
    • 旋转

安装 (更多信息请参见 Flutter FFMPEG)

Android

添加到 android/build.gradle 文件,并在 ext.flutterFFmpegPackage 变量中定义包名。

ext.flutterFFmpegPackage = "min-gpl-lts"

iOS

(Flutter >= 1.20.x)

  • 编辑 ios/Podfile 文件,在 target 'Runner do **之前** 添加以下块,并在 min-gpl-lts 部分指定包名。

      # "fork" of method flutter_install_ios_plugin_pods (in fluttertools podhelpers.rb) to get lts version of ffmpeg
      def flutter_install_ios_plugin_pods(ios_application_path = nil)
       # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.
        ios_application_path ||= File.dirname(defined_in_file.realpath) if self.respond_to?(:defined_in_file)
        raise 'Could not find iOS application path' unless ios_application_path
    
        # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
        # referring to absolute paths on developers' machines.
    
        symlink_dir = File.expand_path('.symlinks', ios_application_path)
        system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.
    
        symlink_plugins_dir = File.expand_path('plugins', symlink_dir)
        system('mkdir', '-p', symlink_plugins_dir)
    
        plugins_file = File.join(ios_application_path, '..', '.flutter-plugins-dependencies')
        plugin_pods = flutter_parse_plugins_file(plugins_file)
        plugin_pods.each do |plugin_hash|
          plugin_name = plugin_hash['name']
          plugin_path = plugin_hash['path']
    
          if (plugin_name && plugin_path)
              symlink = File.join(symlink_plugins_dir, plugin_name)
              File.symlink(plugin_path, symlink)
    
              if plugin_name == 'flutter_ffmpeg'
                  pod plugin_name + '/min-gpl-lts', :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
              else
                  pod plugin_name, :path => File.join('.symlinks', 'plugins', plugin_name, 'ios')
              end
          end
        end
      end
    
  • 确保 flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 函数在
    target 'Runner' do 块内被调用。在这种情况下,添加的函数必须命名为
    flutter_install_ios_plugin_pods,并且您**不要**在该块内显式调用它。

(Flutter < 1.20.x)

  • 编辑 ios/Podfile 文件,并按如下方式修改默认的 # Plugin Pods 块。不要忘记在 min-gpl-lts 部分指定包
    名。

      # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
      # referring to absolute paths on developers' machines.
      system('rm -rf .symlinks')
      system('mkdir -p .symlinks/plugins')
      plugin_pods = parse_KV_file('../.flutter-plugins')
      plugin_pods.each do |name, path|
          symlink = File.join('.symlinks', 'plugins', name)
          File.symlink(path, symlink)
          if name == 'flutter_ffmpeg'
              pod name+'/min-gpl-lts', :path => File.join(symlink, 'ios')
          else
              pod name, :path => File.join(symlink, 'ios')
          end
      end
    

示例 (UI设计完全可定制,请参见 示例)

裁剪视频 旋转视频
crop_video rotate_video

剪辑视频 导出视频
trim_video export_video

GitHub

https://github.com/seel-channel/video_editor