Skip to main content

Export Media on Flutter

Overview

Video Editor SDK allows to export a number of video files with various resolutions and other configurations. Video is exported as .mp4 for Android and .mov for IOS file.

Refer to our main docs Android and IOS to learn more about media export in the Video Editor.

Implement export flow

[!NOTE] Default implementation exports single video file with auto quality(based on device hardware capabilities).

Create a new instance of ExportData to export 2 videos with HD and auto qualities:

const exportData = ExportData(exportedVideos: [
ExportedVideo(
fileName: "export_hd_720p",
videoResolution: VideoResolution.hd720p
),
ExportedVideo(
fileName: "export_auto",
videoResolution: VideoResolution.auto
)]
);

Next, specify it in the start method of the Video Editor:

try {
dynamic exportResult = await _veSdkFlutterPlugin.openCameraScreen(
_licenseToken,
config,
+ exportData: exportData
);
_handleExportResult(exportResult);
} on PlatformException catch (e) {
_handlePlatformException(e);
}

Use AVC codec

You can specify H264(AVC_PROFILES) by setting false to useHevcIfPossible.

const exportData = ExportData(exportedVideos: [
ExportedVideo(
fileName: "export_hd",
videoResolution: VideoResolution.hd720p,
+ useHevcIfPossible: false
)]
);

Add watermark

Watermark is not added to exported video by default.

Specify your watermark in the pubspec.yaml and provide it to the ExportData instance:

const exportData = ExportData(exportedVideos: [
ExportedVideo(
fileName: "export_hd",
videoResolution: VideoResolution.hd720p
)],
+ watermark: Watermark(
+ imagePath: "assets/watermark.png",
+ alignment: WatermarkAlignment.bottomRight
+ )
);