减少Flutter / Dart中的视频文件大小 [英] Reduce video file size in Flutter / Dart

查看:1179
本文介绍了减少Flutter / Dart中的视频文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,用户可以在其中将视频上传到我们的服务器。他们可以从图库中选择视频,所以我想在上传之前缩小视频。

I am working on an application where users can upload videos to our server. They can select videos from their gallery, so I would like to reduce them before uploading.

我想知道是否有任何方法可以减少视频文件的大小颤振/飞镖。谢谢。

I would like to know if there is any way to reduce the video file size with Flutter/ Dart. Thanks.

推荐答案

更新:由于我的原始回答,因此还有另一个软件包 https://pub.dev/packages/flutter_video_compress 使用更友好的API

Update: since my original answer, there's another package https://pub.dev/packages/flutter_video_compress with friendlier API

https://pub.dartlang.org/packages/flutter_ffmpeg 非常好,并且有详细记录的说明

https://pub.dartlang.org/packages/flutter_ffmpeg is pretty good, and has well-documented instruction

import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';

 final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();

 _flutterFFmpeg.execute("-i file1.mp4 -c:v mpeg4 file2.mp4").then((rc) => print("FFmpeg process exited with rc $rc"));

检查 rc 代码,如果成功,打开 file2.mp4 ,它是压缩/处理后的文件。

Check the rc code, and if it's successful, open file2.mp4, which is the compressed/processed file.

这篇关于减少Flutter / Dart中的视频文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆