如何削减/ /修剪就一段视频在时间或百分比,并保存在不同的文件输出百分比、并保存、不同、文件

2023-09-03 12:29:37 作者:傻瓜的情殤

是否有任何教程或C#库,其中帮我完成以下

Is there any tutorial or a c# library which which help me to accomplish the following

1)选择了一个文件,进行编辑 2)要求用户选择剪切/ /修剪方法: - 按时间或按比例 3)剪切/裁切/按时间或百分比修剪视频的选择(比如我希望减少5分钟的视频到4分钟的视频,或减少80%视频) 4)保存视频的要求,在需要的路径

1) Chose a file to edit 2) Ask user to select cut/crop/trim method :- by time or by percentage 3) cut/crop/trim the video by time or percentage as chosen ( say I wish to reduce a 5 minute video to 4 minute video, or reduce the video by 80%) 4) Save the video as requested in required path

现在步骤1),4)我已经实现,但无法找到一个很好的C#库来完成3),4)

now steps 1) and 4) I have implemented but could not find a good c# library to accomplish 3) and 4)

我抬头看了看ffmpeg的库,但找不到好的C#包装完成的要求

I looked up the ffmpeg library but could not find a good C# wrapper to accomplish the requirements

任何帮助将深深AP preciated

Any help will be be deeply appreciated

感谢您

推荐答案

ffmpeg的是一个非常强大的应用程序,我已经用了很多次,甚至从C#。你并不需要一个C#包装库。所有你需要做的就是利用执行从C#的ffmpeg的命令:

ffmpeg is a very powerful application and I have used it many times, even from C#. You don't need a C# wrapper library. All you have to do is execute the ffmpeg commands from C# using:

System.Diagnostics.Process.Start(字符串文件名,字符串参数);

或者使用 System.Diagnostics.ProcessStartInfo 来重定向标准输出,如果你需要。

Or use System.Diagnostics.ProcessStartInfo to redirect standard output if you need to.

本文介绍了如何使用 System.Diagnostics程序执行同步和异步命令等 HTTP://www.$c$cproject.com/KB/cs/Execute_Command_in_CSharp的.aspx

This article explains how to use System.Diagnostics to execute synchronous and asynchronous commands, etc. http://www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx

下面是一个如何削减下来的视频文件来使用的ffmpeg从C#的第4分钟一个简单的例子。

Here's a simple example of how to cut a video file down to its first 4 minutes using ffmpeg from C#.

using System.Diagnostics
Process.Start("ffmpeg.exe",
              "-sameq -t 240 -i InputVideoFile.avi OutputVideoFile.avi");

下面是一个如何使用SO例如 System.Diagnostics.ProcessStartInfo C#和FFmpeg的preferably没有shell命令?

Here's a SO example of how to use System.Diagnostics.ProcessStartInfo C# and FFmpeg preferably without shell commands?

有很多的在线资源解释所​​有的FFmpeg的功能以及如何使用它们,只需搜索。

There are lots of online resources that explain all of ffmpeg's features and how to use them, just search.