如何在Flutter中使用light_compressor包设置视频的特定最小比特率?

发布于 2025-01-15 05:05:43 字数 689 浏览 3 评论 0原文

我尝试使用 flutter 的 light_compressor 包来压缩我用手机拍摄或从 YouTube 下载的视频。

我参考下面的文章。 https://morioh.com/p/ac6f0d2c176b 本文中可以设置最小码率,默认值为2mbps。

但示例代码中只有isMinBitrateCheckEnabled标志,并没有设置具体码率的参数。

如何将视频压缩到我想要的比特率?

以下是示例代码的一部分。

import 'package:light_compressor/light_compressor.dart';


final LightCompressor _lightCompressor = LightCompressor();
final dynamic response = await _lightCompressor.compressVideo(
  path: _sourcePath,
  destinationPath: _destinationPath,
  videoQuality: VideoQuality.medium,
  isMinBitrateCheckEnabled: false,
  frameRate: 24 /* or ignore it */);

I tried using flutter's light_compressor package to compress a video I shot with my phone or downloaded from YouTube.

I refer to the article below.
https://morioh.com/p/ac6f0d2c176b
In this article, the minimum bit rate can be set and the default value is 2mbps.

However, in the sample code, only the flag isMinBitrateCheckEnabled exists, and there is no parameter to set a specific bit rate.

How do I compress the video to my desired bitrate?

Below is a part of the sample code.

import 'package:light_compressor/light_compressor.dart';


final LightCompressor _lightCompressor = LightCompressor();
final dynamic response = await _lightCompressor.compressVideo(
  path: _sourcePath,
  destinationPath: _destinationPath,
  videoQuality: VideoQuality.medium,
  isMinBitrateCheckEnabled: false,
  frameRate: 24 /* or ignore it */);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

久随 2025-01-22 05:05:43

该函数的架构是:

compressVideo(
  path,
  result,
  quality,
  isSharedStorage,
  isMinBitrateCheckEnabled,
  videoBitrateInMbps,
  disableAudio,
  keepOriginalResolution,
  videoHeight,
  videoWidth,
  saveAt,
  videoName
)

您可以通过 videoBitrateInMbps 属性设置比特率。希望这对您有帮助。

The schema for the function is:

compressVideo(
  path,
  result,
  quality,
  isSharedStorage,
  isMinBitrateCheckEnabled,
  videoBitrateInMbps,
  disableAudio,
  keepOriginalResolution,
  videoHeight,
  videoWidth,
  saveAt,
  videoName
)

You can set the bitrate through the videoBitrateInMbps attribute. Hope this helps you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文