Truvideo Video SDK
This plugin integrates TruvideoVideoSdk for handling video files, including browsing, editing, encoding, and merging videos.
Supported Platforms
- ✅ Android
- ✅ iOS
Features
- Loads and displays videos from a directory
- Edits videos
- Generates thumbnails
- Compares videos
- Retrieves video information
- Clears noise from videos
- Encode videos using
EncodeBuilder - Merge videos using
MergeBuilder - Concatenate videos using
ConcatBuilder
Requirements
- TruvideoVideoSdk Plugin
Setup
- Add TruvideoVideoSdk Plugin to your project.
- Install dependencies:
flutter pub get - Ensure proper permissions in
AndroidManifest.xml&Info.plist. - Run the app:
flutter run
Usage
- Edit a video:
void editVideo(String videoPath) { TruvideoVideoSdk.editVideo( inputPath: videoPath, outputPath: "\${directoryPath}/edited_video.mp4", onResult: (String? result) { print("Video edited successfully: \$result"); }, onError: (String? message) { print("Video editing failed: \$message"); }, ); } - Generate a thumbnail:
void generateThumbnail(String videoPath) { TruvideoVideoSdk.generateThumbnail( videoUri: videoPath, outputPath: "", position: 1000, width: 300, height: 300, precise: true, onResult: (String? result) { print("Thumbnail generated successfully: \$result"); }, onError: (String? message) { print("Thumbnail generation failed: \$message"); }, ); } - Retrieve video information:
void getVideoInfo(String videoPath) { TruvideoVideoSdk.getVideoInfo( videoUri: videoPath, onResult: (String? result) { print("Video info: \$result"); }, onError: (String? message) { print("Failed to fetch video info: \$message"); }, ); } - Clear noise from a video:
void clearNoise(String videoPath) { TruvideoVideoSdk.cleanNoise( videoUri: videoPath, outputPath: "\${directoryPath}/noise_removed.mp4", onResult: (String? result) { print("Noise cleared successfully: \$result"); }, onError: (String? message) { print("Noise clearing failed: \$message"); }, ); } - Encode a video:
Future<void> encodeVideo(String videoPath) async { final builder = EncodeBuilder( filePath: videoPath, resultPath: "$directoryPath/encoded.mp4", ) ..setWidth(1280) ..setHeight(720) ..setFrameRate(TruvideoSdkVideoFrameRate.sixtyFps); await builder.build(); final result = await builder.process(); } - Compare multiple videos:
void compareVideos(List<String> videoPaths) { TruvideoVideoSdk.compareVideos( videoUris: videoPaths, onResult: (bool? result) { print("Videos comparison result: \$result"); }, onError: (String? message) { print("Video comparison failed: \$message"); }, ); } - Concatenate multiple videos:
Future<void> concatVideos(List<String> videoPaths) async { final builder = ConcatBuilder( filePaths: videoPaths, resultPath: "$directoryPath/concat.mp4", ); await builder.build(); final result = await builder.process(); } - Merge multiple videos:
Future<void> mergeVideos(List<String> videoPaths) async { final builder = MergeBuilder( filePaths: videoPaths, resultPath: "$directoryPath/merged.mp4", ) ..setWidth(480) ..setHeight(640) ..setFrameRate(TruvideoSdkVideoFrameRate.thirtyFps); await builder.build(); final result = await builder.process(); }
Documentation
For more details, please refer to the official documentation: Truvideo Swift SDK Guide
License
MIT
Support
If you have any questions or suggestions regarding the SDK, please contact us at support@truvideo.com.