如何在抖动中压缩视频? [英] How to compress a video in flutter?
问题描述
如何在抖动中压缩视频?我正在使用image_picker从图库中选择视频,该视频在iOS上将视频从30MB压缩到10MB,但在android中没有压缩.有没有办法使用飞镖操纵视频的大小或质量?flutter中是否有用于压缩视频的现有软件包?
How to compress a video in flutter? I'm using image_picker to pick video from gallery which compress the video from 30MB to 10MB on iOS but in android there is no compression. Is there a way to manipulate the size or quality of video using dart? Are there any existing packages in flutter to compress video?
推荐答案
Update: since my original answer (as pointed out in the comment), there's another package https://pub.dev/packages/flutter_video_compress with friendlier API
在另一个类似问题中看到我的答案:
See my answer in another similar question:
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.
这篇关于如何在抖动中压缩视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!