以前も同じものを作ったのだけれど、もっと簡単に。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
public Form1() { InitializeComponent(); 実行.Click += (s, e) => { DateTime.TryParse(開始.Text, out var start); DateTime.TryParse(終了.Text, out var end); TimeSpan interval = end - start; TimeSpan startPosition = new TimeSpan(start.Hour, start.Minute, start.Second); string cmd = "-ss " + startPosition.TotalSeconds.ToString() + " -i \"i.mp4\" -t " + interval + " \"o.mp4\""; System.Diagnostics.Process p = System.Diagnostics.Process.Start(Application.StartupPath + @"\ffmpeg.exe", cmd); p.WaitForExit(); }; } |