FFMPEG 进行视频剪切
剪切从0:0:10开始时长30s的视频
ffmpeg -ss 0:0:10 -t 0:0:30 -i input.avi -vcodec copy -acodec copy output.avi
需要去官网下载ffmpeg.exe:
Web网页地址:
下载完之后解压如下:
C# 使用线程调用代码:
ProcessStartInfo info = new ProcessStartInfo(exePath, arguments);
info.UseShellExecute = true;
info.RedirectStandardInput = false;//可能接受来自调用程序的输入信息
info.RedirectStandardOutput = false;//由调用程序获取输出信息
info.RedirectStandardError = false;//重定向标准错误输出
info.CreateNoWindow = false;//不显示程序窗口
Process AppProcess = System.Diagnostics.Process.Start(info);
// Wait for process to be created and enter idle condition
AppProcess.WaitForExit();
其中:
exePath是指下载下来的“ffmpeg.exe”路径如下:
C:\Users\DELL\Desktop\ffmpeg-20200721-b5f1e05-win64-static\ffmpeg-20200721-b5f1e05-win64-static\bin\ ffmpeg.exe
arguments是指执行ffmpeg命令的参数如下:
-ss 0:0:10 -t 0:0:30 -i input.avi(http
路径和本地file路径) -vcodec copy -acodec copy output.avi(保存位置的路径)
下载位置: