createExportCommand method
- required String inputPath,
- required String outputPath,
- VideoExportFormat outputFormat = VideoExportFormat.mp4,
- double scale = 1.0,
- String customInstruction = '',
- VideoExportPreset preset = VideoExportPreset.none,
- bool isFiltersEnabled = true,
Create an FFmpeg command string to export a video with the specified parameters.
The inputPath specifies the location of the input video file to be exported.
The outputPath specifies the path where the exported video file should be saved.
The outputFormat of the video to be exported, by default VideoExportFormat.mp4.
You can export as a GIF file by using VideoExportFormat.gif or with
GifExportFormat() which allows you to control the frame rate of the exported GIF file.
The scale is scale=width*scale:height*scale and reduce or increase video size.
The customInstruction param can be set to add custom commands to the FFmpeg eexecution
(i.e. -an to mute the generated video), some commands require the GPL package
The preset is the compress quality (Only available on GPL package).
A slower preset will provide better compression (compression is quality per filesize).
More info about presets
Set isFiltersEnabled to false if you do not want to apply any changes
Implementation
String createExportCommand({
required String inputPath,
required String outputPath,
VideoExportFormat outputFormat = VideoExportFormat.mp4,
double scale = 1.0,
String customInstruction = '',
VideoExportPreset preset = VideoExportPreset.none,
bool isFiltersEnabled = true,
}) {
final filter = getExportFilters(
videoFormat: outputFormat,
scale: scale,
isFiltersEnabled: isFiltersEnabled,
);
return '-i $inputPath $customInstruction $filter ${preset.ffmpegPreset} $trimCommand -y $outputPath';
}