Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: convert the edited video to mp4 with x264

Prateek Sunal8df04b236399
diff --git a/mobile/lib/ui/tools/editor/video_editor_page.dart b/mobile/lib/ui/tools/editor/video_editor_page.dart
index d96f0008a7..238c771115 100644
--- a/mobile/lib/ui/tools/editor/video_editor_page.dart
+++ b/mobile/lib/ui/tools/editor/video_editor_page.dart
@@ -209,15 +209,14 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
final config = VideoFFmpegVideoEditorConfig(
_controller!,
- format: VideoExportFormat(
- path.extension(widget.ioFile.path).substring(1),
- ),
- // commandBuilder: (config, videoPath, outputPath) {
- // final List<String> filters = config.getExportFilters();
- // filters.add('hflip'); // add horizontal flip
+ format: VideoExportFormat.mp4,
+ commandBuilder: (config, videoPath, outputPath) {
+ final List<String> filters = config.getExportFilters();
- // return '-i $videoPath ${config.filtersCmd(filters)} -preset ultrafast $outputPath';
- // },
+ final String startTrimCmd = "-ss ${_controller!.startTrim}";
+ final String toTrimCmd = "-t ${_controller!.trimmedDuration}";
+ return '$startTrimCmd -i $videoPath $toTrimCmd ${config.filtersCmd(filters)} -c:v libx264 -c:a aac $outputPath';
+ },
);
try {
@@ -241,12 +240,12 @@ class _VideoEditorPageState extends State<VideoEditorPage> {
await PhotoManager.stopChangeNotify();
try {
- final AssetEntity? newAsset =
+ final AssetEntity newAsset =
await (PhotoManager.editor.saveVideo(result, title: fileName));
result.deleteSync();
final newFile = await EnteFile.fromAsset(
widget.file.deviceFolder ?? '',
- newAsset!,
+ newAsset,
);
newFile.creationTime = widget.file.creationTime;