### Install Easy Video Editor Plugin Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Add the plugin to your pubspec.yaml file or install via the command line. ```yaml dependencies: easy_video_editor: ^0.1.3 ``` ```bash flutter pub add easy_video_editor ``` -------------------------------- ### get currentPath Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Gets the current video path being processed. ```APIDOC ## get currentPath ### Description Gets the current path of the video file being edited. ### Method `get currentPath` ### Returns String representing the current video path. ``` -------------------------------- ### trim() - Trim Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a trim operation to cut the video to a specified start and end time. The operation outputs an MP4 file. ```APIDOC ## trim() - Trim Video ### Description Queues a trim operation that cuts the video to the specified start and end time window. Times are in milliseconds. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder trim({required int startTimeMs, required int endTimeMs}) ``` ### Parameters - **startTimeMs** (int) - Required - The start time in milliseconds. - **endTimeMs** (int) - Required - The end time in milliseconds. ### Request Example ```dart import 'package:easy_video_editor/easy_video_editor.dart'; final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .trim(startTimeMs: 2000, endTimeMs: 12000); // Keep seconds 2–12 final outputPath = await editor.export( outputPath: '/path/to/trimmed.mp4', onProgress: (progress) => print('Progress: ${(progress * 100).toStringAsFixed(1)}%'), ); if (outputPath != null) { print('Trimmed video saved to: $outputPath'); } else { print('Trim failed'); } ``` ``` -------------------------------- ### Trim Video with specified times Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queue a trim operation to cut the video between specified start and end times in milliseconds. The output will be an MP4 file. Progress can be monitored via the `onProgress` callback. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .trim(startTimeMs: 2000, endTimeMs: 12000); // Keep seconds 2–12 final outputPath = await editor.export( outputPath: '/path/to/trimmed.mp4', onProgress: (progress) => print('Progress: ${(progress * 100).toStringAsFixed(1)}%'), ); if (outputPath != null) { print('Trimmed video saved to: $outputPath'); } else { print('Trim failed'); } ``` -------------------------------- ### Initialize VideoEditorBuilder Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Create an instance of `VideoEditorBuilder` with the path to your input video. You can access the current video path at any time. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Create a builder with the path to the source video final editor = VideoEditorBuilder(videoPath: '/storage/emulated/0/Movies/input.mp4'); // Access the current video path at any time print(editor.currentPath); // /storage/emulated/0/Movies/input.mp4 ``` -------------------------------- ### Add easy_video_editor via CLI Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Alternatively, add the plugin to your project using the Flutter CLI. ```bash flutter pub add easy_video_editor ``` -------------------------------- ### VideoEditorBuilder Constructor Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Initializes the VideoEditorBuilder with the path to the source video. This is the entry point for all editing operations. ```APIDOC ## VideoEditorBuilder Constructor ### Description Initializes the `VideoEditorBuilder` with the path to the source video. This is the entry point for all editing operations. ### Usage ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Create a builder with the path to the source video final editor = VideoEditorBuilder(videoPath: '/storage/emulated/0/Movies/input.mp4'); // Access the current video path at any time print(editor.currentPath); // /storage/emulated/0/Movies/input.mp4 ``` ``` -------------------------------- ### VideoEditorBuilder Constructor Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Initializes the VideoEditorBuilder with the path to the video file to be edited. ```APIDOC ## VideoEditorBuilder Constructor ### Description Creates a new builder instance with the specified video path. ### Parameters #### Path Parameters - **videoPath** (String) - Required - The absolute path to the video file. ``` -------------------------------- ### Basic Video Editing Operations Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Demonstrates basic video editing tasks like trimming, speed adjustment, and audio removal using a chainable API. Requires importing the library and creating a VideoEditorBuilder instance. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Create a builder instance final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4') .trim(startTimeMs: 0, endTimeMs: 5000) // Trim first 5 seconds .speed(speed: 1.5) // Speed up by 1.5x .removeAudio(); // Remove audio // Export the edited video with progress tracking final outputPath = await editor.export( outputPath: '/path/to/output.mp4', // Optional output path onProgress: (progress) { // Progress ranges from 0.0 to 1.0 (0% to 100%) print('Export progress: ${(progress * 100).toStringAsFixed(1)}%'); // Update UI with progress information // e.g., setState(() => exportProgress = progress); } ); ``` -------------------------------- ### Chaining Multiple Operations Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Demonstrates how to chain multiple video editing operations using the builder pattern for a fluent and declarative editing pipeline. All operations are executed sequentially upon export. ```APIDOC ## Chaining Multiple Operations All builder methods return `this`, enabling fluent chaining of any combination of operations that are executed sequentially on export. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future fullEditingPipeline() async { final editor = VideoEditorBuilder(videoPath: '/path/to/raw_footage.mp4') .trim(startTimeMs: 5000, endTimeMs: 35000) // Keep 5–35s .merge(otherVideoPaths: ['/path/to/clip2.mp4']) // Append second clip .speed(speed: 1.25) // Speed up by 25% .crop(aspectRatio: VideoAspectRatio.ratio16x9) // Crop to widescreen .rotate(degree: RotationDegree.degree90) // Rotate 90° clockwise .compress(resolution: VideoResolution.p1080) // Compress to 1080p .removeAudio(); // Mute final output double progress = 0; final outputPath = await editor.export( outputPath: '/path/to/final_edit.mp4', onProgress: (p) { progress = p; print('Pipeline progress: ${(p * 100).toStringAsFixed(1)}%'); }, ); print(outputPath != null ? 'Done: $outputPath' : 'Pipeline failed'); // After export, access the updated current path print('Current path: ${editor.currentPath}'); } ``` ``` -------------------------------- ### Add easy_video_editor to pubspec.yaml Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Add the plugin to your project's dependencies in `pubspec.yaml`. ```yaml dependencies: easy_video_editor: ^0.1.3 ``` -------------------------------- ### Using VideoMetadata Model Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Shows how to retrieve and use the VideoMetadata model, including serialization to a map and reconstruction from a map. The toString() method provides a human-readable representation. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future useVideoMetadata() async { final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4'); final VideoMetadata meta = await editor.getVideoMetadata(); // Serialize to map (e.g., for JSON storage or API upload) final Map map = meta.toMap(); print(map); // {duration: 15320, width: 1920, height: 1080, title: null, // author: null, rotation: 0, fileSize: 52428800, date: "2024-01-15"} // Human-readable string representation print(meta.toString()); // VideoMetadata(duration: 15320 ms, width: 1920, height: 1080, // title: null, author: null, rotation: 0°, fileSize: 50.00 KB, date: 2024-01-15) // Reconstruct from map final VideoMetadata restored = VideoMetadata.fromMap(map); print('Restored duration: ${restored.duration} ms'); } ``` -------------------------------- ### Advanced Video Editing Chain Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Illustrates chaining multiple advanced video editing operations including merging, compression, cropping, rotation, and flipping. Also shows how to extract audio, generate thumbnails, and retrieve video metadata. ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4') // Trim video .trim(startTimeMs: 1000, endTimeMs: 6000) // Merge with another video .merge(otherVideoPaths: ['/path/to/second.mp4']) // Adjust speed .speed(speed: 1.5) // Compress video .compress(resolution: VideoResolution.p720) // Crop video .crop(aspectRatio: VideoAspectRatio.ratio16x9) // Rotate video .rotate(degree: RotationDegree.d90) // Flip video .flip(flipDirection: FlipDirection.horizontal); // Export the final video final outputPath = await editor.export( outputPath: '/path/to/output.mp4' // Optional output path ); // Extract audio final audioPath = await editor.extractAudio( outputPath: '/path/to/output.m4a' // Optional output path, iOS outputs M4A format ); // Generate thumbnail final thumbnailPath = await editor.generateThumbnail( positionMs: 2000, quality: 85, width: 1280, // optional height: 720, // optional outputPath: '/path/to/thumbnail.jpg' // Optional output path ); // Get video metadata final metadata = await editor.getVideoMetadata(); print('Duration: ${metadata.duration} ms'); print('Dimensions: ${metadata.width}x${metadata.height}'); print('Orientation: ${metadata.rotation}°'); print('File size: ${metadata.fileSize} bytes'); print('Creation date: ${metadata.date}'); ``` -------------------------------- ### Chaining Multiple Video Editing Operations Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Demonstrates a fluent chain of video editing operations using the VideoEditorBuilder. Operations are executed sequentially upon export. Progress is reported via a callback. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future fullEditingPipeline() async { final editor = VideoEditorBuilder(videoPath: '/path/to/raw_footage.mp4') .trim(startTimeMs: 5000, endTimeMs: 35000) // Keep 5–35s .merge(otherVideoPaths: ['/path/to/clip2.mp4']) // Append second clip .speed(speed: 1.25) // Speed up by 25% .crop(aspectRatio: VideoAspectRatio.ratio16x9) // Crop to widescreen .rotate(degree: RotationDegree.degree90) // Rotate 90° clockwise .compress(resolution: VideoResolution.p1080) // Compress to 1080p .removeAudio(); // Mute final output double progress = 0; final outputPath = await editor.export( outputPath: '/path/to/final_edit.mp4', onProgress: (p) { progress = p; print('Pipeline progress: ${(p * 100).toStringAsFixed(1)}%'); }, ); print(outputPath != null ? 'Done: $outputPath' : 'Pipeline failed'); // After export, access the updated current path print('Current path: ${editor.currentPath}'); } ``` -------------------------------- ### crop() — Crop to Aspect Ratio Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a crop operation that center-crops the video to a predefined aspect ratio. Available ratios: `ratio16x9`, `ratio4x3`, `ratio1x1`, `ratio9x16`, `ratio3x4`. Outputs an MP4 file. ```APIDOC ## crop() ### Description Queues a crop operation that center-crops the video to a predefined aspect ratio. Available ratios: `ratio16x9`, `ratio4x3`, `ratio1x1`, `ratio9x16`, `ratio3x4`. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder crop({required VideoAspectRatio aspectRatio}) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `VideoAspectRatio` - **`VideoAspectRatio.ratio16x9`**: '16:9' (widescreen) - **`VideoAspectRatio.ratio4x3`**: '4:3' (standard) - **`VideoAspectRatio.ratio1x1`**: '1:1' (square) - **`VideoAspectRatio.ratio9x16`**: '9:16' (vertical) - **`VideoAspectRatio.ratio3x4`**: '3:4' (vertical standard) ### Request Example ```dart final squareEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .crop(aspectRatio: VideoAspectRatio.ratio1x1); final squareOutput = await squareEditor.export(outputPath: '/path/to/square.mp4'); print('Square video: $squareOutput'); ``` ### Response #### Success Response Returns the output path of the processed video. #### Response Example ``` /path/to/square.mp4 ``` ``` -------------------------------- ### VideoMetadata Model Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Explains the `VideoMetadata` model, which is returned by `getVideoMetadata()`. It provides parsed video properties and supports serialization to/from a map. ```APIDOC ## VideoMetadata Model The `VideoMetadata` class is returned by `getVideoMetadata()` and exposes all parsed video properties. It supports serialization to/from a map for storage or transmission. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future useVideoMetadata() async { final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4'); final VideoMetadata meta = await editor.getVideoMetadata(); // Serialize to map (e.g., for JSON storage or API upload) final Map map = meta.toMap(); print(map); // {duration: 15320, width: 1920, height: 1080, title: null, // author: null, rotation: 0, fileSize: 52428800, date: "2024-01-15"} // Human-readable string representation print(meta.toString()); // VideoMetadata(duration: 15320 ms, width: 1920, height: 1080, // title: null, author: null, rotation: 0°, fileSize: 50.00 KB, date: 2024-01-15) // Reconstruct from map final VideoMetadata restored = VideoMetadata.fromMap(map); print('Restored duration: ${restored.duration} ms'); } ``` ``` -------------------------------- ### Execute All Queued Operations and Export Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Processes all queued operations in sequence, automatically cleaning up intermediate files. Returns the final output path or null on failure. Accepts an optional output path and progress callback. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; double _progress = 0.0; Future exportVideo() async { final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .trim(startTimeMs: 0, endTimeMs: 10000) .compress(resolution: VideoResolution.p720) .crop(aspectRatio: VideoAspectRatio.ratio16x9) .removeAudio(); final outputPath = await editor.export( outputPath: '/path/to/final_output.mp4', onProgress: (progress) { // Called for each operation; progress is normalized across all operations (0.0–1.0) setState(() => _progress = progress); print('Overall progress: ${(progress * 100).toStringAsFixed(1)}%'); }, ); if (outputPath != null) { print('Export complete: $outputPath'); } else { print('Export failed'); } } ``` -------------------------------- ### Crop Video to Aspect Ratio Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a crop operation to center-crop the video to a predefined aspect ratio. Outputs an MP4 file. Available ratios include 16:9, 4:3, 1:1, 9:16, and 3:4. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Crop to square (1:1) — ideal for social media posts final squareEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .crop(aspectRatio: VideoAspectRatio.ratio1x1); final squareOutput = await squareEditor.export(outputPath: '/path/to/square.mp4'); print('Square video: $squareOutput'); // Crop to vertical (9:16) — ideal for Reels/Shorts/TikTok final verticalEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .crop(aspectRatio: VideoAspectRatio.ratio9x16); final verticalOutput = await verticalEditor.export(outputPath: '/path/to/vertical.mp4'); print('Vertical video: $verticalOutput'); // Available VideoAspectRatio values: // VideoAspectRatio.ratio16x9 → '16:9' (widescreen) // VideoAspectRatio.ratio4x3 → '4:3' (standard) // VideoAspectRatio.ratio1x1 → '1:1' (square) // VideoAspectRatio.ratio9x16 → '9:16' (vertical) // VideoAspectRatio.ratio3x4 → '3:4' (vertical standard) ``` -------------------------------- ### export Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Exports the edited video to a specified output path. Progress can be tracked via a callback. ```APIDOC ## export ### Description Exports the edited video to a specified output path with optional progress tracking. ### Parameters #### Path Parameters - **outputPath** (String) - Optional - The path where the edited video will be saved. If not provided, a default path will be used. - **onProgress** (Function(double)) - Optional - A callback function that receives the export progress as a double between 0.0 and 1.0. ``` -------------------------------- ### Cancel Video Editing Operation Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Demonstrates how to initiate a video editing operation and then cancel it before completion using the `cancel()` method. ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4'); // Start an operation final outputPath = await editor.trim(startTimeMs: 0, endTimeMs: 5000); // Cancel the operation await editor.cancel(); ``` -------------------------------- ### compress Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Compresses the video to a standard resolution. Outputs an MP4 file. ```APIDOC ## compress ### Description Compresses the video to a standard resolution, maintaining the original aspect ratio. ### Method `compress({VideoResolution resolution = VideoResolution.p720})` ### Parameters - **resolution** (VideoResolution) - Optional - The target resolution (e.g., 360p, 480p, 720p, 1080p, 2160p). Defaults to 720p. ### Outputs MP4 video file. ``` -------------------------------- ### generateThumbnail Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Generates a thumbnail image from the video at a specified position. Outputs a JPEG file. ```APIDOC ## generateThumbnail ### Description Generates a thumbnail image from the video at a specified time position. ### Method `generateThumbnail({required int positionMs, required int quality, int? width, int? height, String? outputPath})` ### Parameters - **positionMs** (int) - Required - The time position in milliseconds from which to generate the thumbnail. - **quality** (int) - Required - The quality of the generated thumbnail (e.g., 1-100). - **width** (int) - Optional - The desired width of the thumbnail. - **height** (int) - Optional - The desired height of the thumbnail. - **outputPath** (String) - Optional - The path to save the generated JPEG thumbnail. ### Outputs JPEG image file. ``` -------------------------------- ### Generate Thumbnail from Video Frame with generateThumbnail() Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Generates a JPEG thumbnail from a video at a specific time. Supports custom dimensions and exact-frame extraction. The quality can be adjusted from 0 to 100. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future createThumbnail() async { final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4'); // Generate a 1280×720 thumbnail at the 3-second mark with high quality final thumbnailPath = await editor.generateThumbnail( positionMs: 3000, // 3 seconds into the video quality: 90, // Quality 0–100 width: 1280, // Optional: target width in pixels height: 720, // Optional: target height in pixels exactFrame: true, // Seek to the exact frame (may be slower) outputPath: '/path/to/thumbnail.jpg', ); if (thumbnailPath != null) { print('Thumbnail saved to: $thumbnailPath'); } else { print('Thumbnail generation failed'); } } ``` -------------------------------- ### export() — Execute All Queued Operations Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Processes all queued operations in sequence, cleaning up intermediate files automatically. Returns the final output path, or `null` on failure. Accepts an optional output path and progress callback. ```APIDOC ## export() ### Description Processes all queued operations in sequence, cleaning up intermediate files automatically. Returns the final output path, or `null` on failure. Accepts an optional output path and progress callback. ### Method Signature ```dart Future export({ required String outputPath, Function(double progress)? onProgress, }) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `export` method: - **`outputPath`** (String) - Required - The path where the final processed video will be saved. - **`onProgress`** (Function(double)?) - Optional - A callback function that receives the progress of the export operation as a double between 0.0 and 1.0. ### Request Example ```dart double _progress = 0.0; Future exportVideo() async { final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .trim(startTimeMs: 0, endTimeMs: 10000) .compress(resolution: VideoResolution.p720) .crop(aspectRatio: VideoAspectRatio.ratio16x9) .removeAudio(); final outputPath = await editor.export( outputPath: '/path/to/final_output.mp4', onProgress: (progress) { // Called for each operation; progress is normalized across all operations (0.0–1.0) // setState(() => _progress = progress); print('Overall progress: ${(progress * 100).toStringAsFixed(1)}%'); }, ); if (outputPath != null) { print('Export complete: $outputPath'); } else { print('Export failed'); } } ``` ### Response #### Success Response Returns the output path of the final processed video upon successful completion. #### Failure Response Returns `null` if the export process fails. #### Response Example (Success) ``` /path/to/final_output.mp4 ``` #### Response Example (Failure) ``` null ``` ``` -------------------------------- ### Track Video Export Progress Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Shows how to monitor the progress of a video export operation using a callback function. The progress value ranges from 0.0 to 1.0, allowing for real-time UI updates. ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/video.mp4') .trim(startTimeMs: 1000, endTimeMs: 10000) .compress(resolution: VideoResolution.p720); // Track export progress double exportProgress = 0.0; // Export with progress updates final outputPath = await editor.export( outputPath: '/path/to/output.mp4', onProgress: (progress) { setState(() { exportProgress = progress; // Update state variable }); // Use progress value (0.0 to 1.0) to update UI // For example, with a LinearProgressIndicator: // LinearProgressIndicator(value: exportProgress) } ); ``` -------------------------------- ### compress Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Compresses the video to a specified resolution, maintaining the aspect ratio. This operation can be chained. ```APIDOC ## compress ### Description Compresses the video to a specified resolution. ### Parameters #### Path Parameters - **resolution** (VideoResolution) - Required - The target video resolution (e.g., VideoResolution.p720). ``` -------------------------------- ### trim Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Trims the video to a specified duration. Outputs an MP4 file. ```APIDOC ## trim ### Description Trims the video to the specified start and end times. ### Method `trim({required int startTimeMs, required int endTimeMs})` ### Parameters - **startTimeMs** (int) - Required - The starting time in milliseconds. - **endTimeMs** (int) - Required - The ending time in milliseconds. ### Outputs MP4 video file. ``` -------------------------------- ### Extract Audio from Video with extractAudio() Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Extracts the audio track from a video file. Outputs M4A on iOS and AAC on Android. The method returns the path to the extracted audio file or null if extraction fails. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future extractAudioFromVideo() async { final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4'); // Extract audio to a specific path final audioPath = await editor.extractAudio( outputPath: '/path/to/extracted_audio.m4a', ); if (audioPath != null) { print('Audio extracted to: $audioPath'); // Use the audio file for playback, upload, etc. } else { print('Audio extraction failed'); } } ``` -------------------------------- ### generateThumbnail Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Generates a thumbnail image from a specific frame of the video. ```APIDOC ## generateThumbnail ### Description Generates a thumbnail image from a specific frame of the video. ### Parameters #### Path Parameters - **positionMs** (int) - Required - The time in milliseconds from which to generate the thumbnail. - **quality** (int) - Required - The quality of the thumbnail image (0-100). - **width** (int) - Optional - The desired width of the thumbnail. - **height** (int) - Optional - The desired height of the thumbnail. - **outputPath** (String) - Optional - The path where the thumbnail image will be saved. ``` -------------------------------- ### iOS Info.plist Keys for Photo Library Access Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Include these keys in your iOS Info.plist file to request user permission for accessing the photo library for video editing and saving. ```xml NSPhotoLibraryUsageDescription This app requires access to the photo library for video editing. NSPhotoLibraryAddUsageDescription This app requires access to the photo library to save edited videos. ``` -------------------------------- ### speed() - Adjust Playback Speed Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues an operation to adjust the video's playback speed. Values less than 1.0 slow down, and values greater than 1.0 speed up. Outputs an MP4 file. ```APIDOC ## speed() - Adjust Playback Speed ### Description Queues a speed adjustment operation. Use values less than 1.0 to slow down and greater than 1.0 to speed up. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder speed({required double speed}) ``` ### Parameters - **speed** (double) - Required - The playback speed factor. Values < 1.0 slow down, values > 1.0 speed up. ### Request Example ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Speed up to 2x final fastEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .speed(speed: 2.0); final fastOutput = await fastEditor.export(outputPath: '/path/to/fast.mp4'); print('2x speed video: $fastOutput'); // Slow down to half speed final slowEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .speed(speed: 0.5); final slowOutput = await slowEditor.export(outputPath: '/path/to/slow.mp4'); print('0.5x speed video: $slowOutput'); ``` ``` -------------------------------- ### extractAudio Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Extracts the audio track from the video and saves it to a specified output path. ```APIDOC ## extractAudio ### Description Extracts the audio track from the video. ### Parameters #### Path Parameters - **outputPath** (String) - Optional - The path where the extracted audio will be saved. Defaults to M4A format on iOS. ``` -------------------------------- ### export Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Processes all pending video operations and exports the final video. Outputs an MP4 file. ```APIDOC ## export ### Description Processes all applied video operations and exports the final video file. ### Method `export({String? outputPath, void Function(double progress)? onProgress})` ### Parameters - **outputPath** (String) - Optional - The custom path for the output MP4 file. - **onProgress** (void Function(double)) - Optional - A callback function that receives the export progress (a value between 0.0 and 1.0). ### Outputs MP4 video file. ``` -------------------------------- ### flip() — Flip Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a flip operation that mirrors the video horizontally or vertically. Outputs an MP4 file. ```APIDOC ## flip() ### Description Queues a flip operation that mirrors the video horizontally or vertically. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder flip({required FlipDirection flipDirection}) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `FlipDirection` - **`FlipDirection.horizontal`**: Mirrors the video left-right. - **`FlipDirection.vertical`**: Mirrors the video top-bottom. ### Request Example ```dart // Horizontal flip final hEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .flip(flipDirection: FlipDirection.horizontal); final hOutput = await hEditor.export(outputPath: '/path/to/flipped_h.mp4'); print('Horizontally flipped: $hOutput'); // Vertical flip final vEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .flip(flipDirection: FlipDirection.vertical); final vOutput = await vEditor.export(outputPath: '/path/to/flipped_v.mp4'); print('Vertically flipped: $vOutput'); ``` ### Response #### Success Response Returns the output path of the processed video. #### Response Example ``` /path/to/flipped_h.mp4 ``` ``` -------------------------------- ### generateThumbnail() — Generate Thumbnail from Video Frame Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Generates a JPEG thumbnail from the video at a specific time position. Supports optional custom dimensions and exact-frame extraction. ```APIDOC ## generateThumbnail() ### Description Generates a JPEG thumbnail from the video at a specific time position. Supports optional custom dimensions and exact-frame extraction. ### Method Instance method ### Parameters #### Request Body - **positionMs** (integer) - Required - The time position in milliseconds from the start of the video. - **quality** (integer) - Optional - The quality of the thumbnail (0-100). - **width** (integer) - Optional - The target width in pixels. - **height** (integer) - Optional - The target height in pixels. - **exactFrame** (boolean) - Optional - If true, seeks to the exact frame (may be slower). - **outputPath** (string) - Required - The path where the thumbnail image will be saved. ### Response - **string?**: The path to the generated thumbnail, or `null` if generation failed. ### Request Example ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4'); await editor.generateThumbnail( positionMs: 3000, quality: 90, width: 1280, height: 720, exactFrame: true, outputPath: '/path/to/thumbnail.jpg', ); ``` ### Response Example ```dart // Returns '/path/to/thumbnail.jpg' or null ``` ``` -------------------------------- ### getVideoMetadata Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Retrieves detailed metadata about the video file. ```APIDOC ## getVideoMetadata ### Description Retrieves detailed metadata about the video file. ### Returns - **metadata** (Map) - A map containing video metadata such as duration, dimensions, orientation, file size, and creation date. ``` -------------------------------- ### compress() — Compress Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a compression operation that reduces video resolution while maintaining the original aspect ratio. Defaults to 720p. Outputs an MP4 file. ```APIDOC ## compress() ### Description Queues a compression operation that reduces video resolution while maintaining the original aspect ratio. Defaults to 720p. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder compress({VideoResolution? resolution}) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `VideoResolution` - **`VideoResolution.p360`**: 360p (640×360) - **`VideoResolution.p480`**: 480p (854×480) - **`VideoResolution.p720`**: 720p (1280×720) [default] - **`VideoResolution.p1080`**: 1080p (1920×1080) - **`VideoResolution.p2160`**: 4K (3840×2160) ### Request Example ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .compress(resolution: VideoResolution.p720); final outputPath = await editor.export( outputPath: '/path/to/compressed.mp4', onProgress: (progress) => print('Compressing: ${(progress * 100).toStringAsFixed(0)}%'), ); print('Compressed video: $outputPath'); ``` ### Response #### Success Response Returns the output path of the processed video. #### Response Example ``` /path/to/compressed.mp4 ``` ``` -------------------------------- ### rotate() — Rotate Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a rotation operation. Supports 90°, 180°, and 270° clockwise rotation. Outputs an MP4 file. ```APIDOC ## rotate() ### Description Queues a rotation operation. Supports 90°, 180°, and 270° clockwise rotation. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder rotate({required RotationDegree degree}) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters for `RotationDegree` - **`RotationDegree.degree90`**: 90° - **`RotationDegree.degree180`**: 180° - **`RotationDegree.degree270`**: 270° ### Request Example ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .rotate(degree: RotationDegree.degree90); final outputPath = await editor.export(outputPath: '/path/to/rotated.mp4'); print('Rotated video: $outputPath'); ``` ### Response #### Success Response Returns the output path of the processed video. #### Response Example ``` /path/to/rotated.mp4 ``` ``` -------------------------------- ### merge Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Merges the current video with other provided video files. Outputs an MP4 file. ```APIDOC ## merge ### Description Merges the current video with a list of other video paths. ### Method `merge({required List otherVideoPaths})` ### Parameters - **otherVideoPaths** (List) - Required - A list of paths to other video files to merge. ### Outputs MP4 video file. ``` -------------------------------- ### merge() - Merge Videos Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a merge operation to append one or more additional videos to the end of the current video. The operation outputs an MP4 file. ```APIDOC ## merge() - Merge Videos ### Description Queues a merge operation that appends one or more additional videos to the end of the current video. Outputs an MP4 file. ### Method Signature ```dart VideoEditorBuilder merge({required List otherVideoPaths}) ``` ### Parameters - **otherVideoPaths** (List) - Required - A list of paths to the videos to be merged. ### Request Example ```dart import 'package:easy_video_editor/easy_video_editor.dart'; final editor = VideoEditorBuilder(videoPath: '/path/to/first.mp4') .merge(otherVideoPaths: [ '/path/to/second.mp4', '/path/to/third.mp4', ]); final outputPath = await editor.export(outputPath: '/path/to/merged.mp4'); if (outputPath != null) { print('Merged video saved to: $outputPath'); } ``` ``` -------------------------------- ### getVideoMetadata Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Retrieves detailed metadata about the current video file. ```APIDOC ## getVideoMetadata ### Description Retrieves detailed metadata about the current video file. ### Method `getVideoMetadata()` ### Returns Detailed video metadata. ``` -------------------------------- ### flip Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Flips the video horizontally or vertically. Outputs an MP4 file. ```APIDOC ## flip ### Description Flips the video horizontally or vertically. ### Method `flip({required FlipDirection direction})` ### Parameters - **direction** (FlipDirection) - Required - The direction of the flip (horizontal or vertical). ### Outputs MP4 video file. ``` -------------------------------- ### Compress Video to a Specific Resolution Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queues a compression operation to reduce video resolution while maintaining the original aspect ratio. Defaults to 720p. Outputs an MP4 file. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .compress(resolution: VideoResolution.p720); final outputPath = await editor.export( outputPath: '/path/to/compressed.mp4', onProgress: (progress) => print('Compressing: ${(progress * 100).toStringAsFixed(0)}%'), ); print('Compressed video: $outputPath'); // Available VideoResolution values: // VideoResolution.p360 → 360p (640×360) // VideoResolution.p480 → 480p (854×480) // VideoResolution.p720 → 720p (1280×720) [default] // VideoResolution.p1080 → 1080p (1920×1080) // VideoResolution.p2160 → 4K (3840×2160) ``` -------------------------------- ### extractAudio() — Extract Audio from Video Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Extracts the audio track from the current video file. Outputs M4A on iOS and AAC on Android. ```APIDOC ## extractAudio() ### Description Extracts the audio track from the current video file. Outputs M4A on iOS and AAC on Android. ### Method Instance method ### Parameters #### Request Body - **outputPath** (string) - Required - The path where the extracted audio file will be saved. ### Response - **string?**: The path to the extracted audio file, or `null` if extraction failed. ### Request Example ```dart final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4'); await editor.extractAudio(outputPath: '/path/to/extracted_audio.m4a'); ``` ### Response Example ```dart // Returns '/path/to/extracted_audio.m4a' or null ``` ``` -------------------------------- ### crop Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Crops the video to a specific aspect ratio. This operation can be chained. ```APIDOC ## crop ### Description Crops the video to a specific aspect ratio. ### Parameters #### Path Parameters - **aspectRatio** (VideoAspectRatio) - Required - The target aspect ratio (e.g., VideoAspectRatio.ratio16x9). ``` -------------------------------- ### Retrieve Video Metadata with getVideoMetadata() Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Retrieves detailed information about a video file, including duration, dimensions, rotation, and file size. Optional fields like title, author, and date are also returned. Use this metadata to conditionally apply operations. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; Future inspectVideo() async { final editor = VideoEditorBuilder(videoPath: '/path/to/input.mp4'); final metadata = await editor.getVideoMetadata(); print('Duration: ${metadata.duration} ms'); // e.g. 15320 ms print('Dimensions: ${metadata.width}x${metadata.height}'); // e.g. 1920x1080 print('Rotation: ${metadata.rotation}°'); // 0, 90, 180, or 270 print('File size: ${(metadata.fileSize / 1048576).toStringAsFixed(2)} MB'); print('Title: ${metadata.title ?? "N/A"}'); print('Author: ${metadata.author ?? "N/A"}'); print('Date: ${metadata.date ?? "N/A"}'); // Use metadata to conditionally apply operations if (metadata.rotation != 0) { print('Video is rotated — consider normalizing orientation'); } if (metadata.fileSize > 50 * 1048576) { print('File is large — consider compressing'); } } ``` -------------------------------- ### extractAudio Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Extracts the audio track from the video into a separate file. ```APIDOC ## extractAudio ### Description Extracts the audio track from the video into a separate file. ### Method `extractAudio({String? outputPath})` ### Parameters - **outputPath** (String) - Optional - The path for the output audio file (M4A on iOS, AAC on Android). ### Outputs Audio file (M4A on iOS, AAC on Android). ``` -------------------------------- ### flip Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Flips the video horizontally or vertically. This operation can be chained. ```APIDOC ## flip ### Description Flips the video horizontally or vertically. ### Parameters #### Path Parameters - **flipDirection** (FlipDirection) - Required - The direction to flip (e.g., FlipDirection.horizontal). ``` -------------------------------- ### cancel() — Cancel Ongoing Operation Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Static method that cancels any currently running video operation. Returns `true` if an operation was successfully cancelled, `false` otherwise. ```APIDOC ## cancel() ### Description Static method that cancels any currently running video operation. Returns `true` if an operation was successfully cancelled, `false` otherwise. ### Method Static method call ### Parameters None ### Response - **boolean**: `true` if cancelled, `false` otherwise. ### Request Example ```dart await VideoEditorBuilder.cancel(); ``` ### Response Example ```dart // Returns true or false ``` ``` -------------------------------- ### Android Permissions for Video Editing Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Add these permissions to your AndroidManifest.xml to allow the app to read and write external storage for video editing. ```xml ``` -------------------------------- ### crop Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Crops the video to a predefined aspect ratio. Outputs an MP4 file. ```APIDOC ## crop ### Description Crops the video to a predefined aspect ratio. ### Method `crop({required VideoAspectRatio aspectRatio})` ### Parameters - **aspectRatio** (VideoAspectRatio) - Required - The desired aspect ratio for cropping. ### Outputs MP4 video file. ``` -------------------------------- ### trim Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Trims the video to a specified duration. This operation can be chained with other editing operations. ```APIDOC ## trim ### Description Trims the video to a specified duration. ### Parameters #### Path Parameters - **startTimeMs** (int) - Required - The start time in milliseconds. - **endTimeMs** (int) - Required - The end time in milliseconds. ``` -------------------------------- ### merge Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Merges the current video with one or more other video files. This operation can be chained. ```APIDOC ## merge ### Description Merges the current video with other video files. ### Parameters #### Path Parameters - **otherVideoPaths** (List) - Required - A list of paths to the video files to merge. ``` -------------------------------- ### Adjust Video Playback Speed Source: https://context7.com/iawtk2302/easy_video_editor/llms.txt Queue a speed adjustment operation. Use values greater than 1.0 to speed up and less than 1.0 to slow down. Outputs an MP4 file. ```dart import 'package:easy_video_editor/easy_video_editor.dart'; // Speed up to 2x final fastEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .speed(speed: 2.0); final fastOutput = await fastEditor.export(outputPath: '/path/to/fast.mp4'); print('2x speed video: $fastOutput'); // Slow down to half speed final slowEditor = VideoEditorBuilder(videoPath: '/path/to/input.mp4') .speed(speed: 0.5); final slowOutput = await slowEditor.export(outputPath: '/path/to/slow.mp4'); print('0.5x speed video: $slowOutput'); ``` -------------------------------- ### speed Source: https://github.com/iawtk2302/easy_video_editor/blob/main/README.md Adjusts the playback speed of the video. This operation can be chained. ```APIDOC ## speed ### Description Adjusts the playback speed of the video. ### Parameters #### Path Parameters - **speed** (double) - Required - The speed factor (e.g., 1.5 for 1.5x speed). ```