How to set specific minimal bitrate of video with light_compressor package in Flutter?

422 Views Asked by At

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 */);
1

There are 1 best solutions below

0
On

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.