Skip to content

Commit

Permalink
新增Web端的缩略图。但在部署后测试失败。
Browse files Browse the repository at this point in the history
  • Loading branch information
autodotua committed Jul 18, 2023
1 parent 24e2a5d commit 6468423
Show file tree
Hide file tree
Showing 10 changed files with 4,371 additions and 7,865 deletions.
2 changes: 2 additions & 0 deletions SimpleFFmpegGUI.Core/IPipeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,7 @@ public interface IPipeService
public int GetDefaultProcessPriority();

public void SetDefaultProcessPriority(int priority);

public string GetSnapshot(string path,double seconds);
}
}
4 changes: 2 additions & 2 deletions SimpleFFmpegGUI.Core/Manager/MediaInfoManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ await Task.Run(() =>
return mediaInfo;
}

public static async Task<string> GetSnapshotAsync(string path, TimeSpan time, string scale)
public static async Task<string> GetSnapshotAsync(string path, TimeSpan time, string scale,string format="bmp")
{
string tempPath = FileSystemUtility.GetTempFileName("snapshot") + ".bmp";
string tempPath = $"{FileSystemUtility.GetTempFileName("snapshot")}.{format}";
FFmpegProcess process = new FFmpegProcess($"-ss {time.TotalSeconds:0.000} -i \"{path}\" -vframes 1 -vf scale={scale} {tempPath}");
await process.StartAsync(null, null);
return tempPath;
Expand Down
7 changes: 6 additions & 1 deletion SimpleFFmpegGUI.Host/PipeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,13 @@ public void SetDefaultProcessPriority(int priority)
ConfigManager.DefaultProcessPriority = priority;
foreach (var task in manager.Managers)
{
task.Process.Priority=priority;
task.Process.Priority = priority;
}
}

public string GetSnapshot(string path, double seconds)
{
return MediaInfoManager.GetSnapshotAsync(path, TimeSpan.FromSeconds(seconds), "-1:480", "jpg").Result;
}
}
}
Loading

0 comments on commit 6468423

Please sign in to comment.