@page "/export" @using System.IO @using Timelapse.Api; @using ElectronNET.API; @using Timelapse.Data; @using Xabe.FFmpeg; @using Xabe.FFmpeg.Extensions; @inject ExtensionProjectService EPS; @inject NavigationManager NavigationManager

Export Project

@if(EPS.IsProjectLoaded) {
}else{

Please Load A Project

} @code { public string VideoPath {get;set;} public async Task Browse() { string filename=await Electron.Dialog.ShowSaveDialogAsync(Electron.WindowManager.BrowserWindows.First(),new SaveDialogOptions() { Filters = new ElectronNET.API.Entities.FileFilter[] {new ElectronNET.API.Entities.FileFilter() {Name="MPEG-4 Video", Extensions=new string[] {"mp4"}}}}); if(!string.IsNullOrWhiteSpace(filename)) { VideoPath=filename; } } // public int Progress {get;set;} public async Task Export() { int count=1; while(File.Exists( Path.Combine(EPS.ProjectDirectory,"Sections",EPS.Project.CurrentSection,$"{count}.png") )) { count++; } count--; var cmd=FFmpeg.Conversions.New().BuildVideoFromImages(Enumerable.Range(1,count).Select(e=>Path.Combine(EPS.ProjectDirectory,"Sections",EPS.Project.CurrentSection,$"{e}.png"))).SetFrameRate(20).SetPixelFormat(PixelFormat.yuv420p).SetOutput(VideoPath); await cmd.Start(); Electron.Notification.Show(new ElectronNET.API.Entities.NotificationOptions("TimelapseNow","Video Export Complete")); await Electron.Dialog.ShowMessageBoxAsync("Export Complete"); } }