ffmpeg used in window with .net
来源:互联网 发布:python找不到工作 编辑:程序博客网 时间:2024/05/20 13:41
public static bool Encode(string sourceFilePath, string outputFilePath, out long fileSize,out decimal playTime)
{
fileSize = 0;
playTime = 0M;
try
{
ProcessStartInfo startInfo = new ProcessStartInfo(Ffmpeg_Path);
startInfo.UseShellExecute = false;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.Arguments = " -i " + sourceFilePath + " -ab 32k -ar 22050 -b 350k -r 15 -qmin 6 -qmax 20 -s 320x240 -y " + outputFilePath;
//------------------------------------------------------//
//System.Diagnostics.Process.Start(startInfo); //
//此方法无法等待进程完成,所以更新为下面的方式执行。 //
//------------------------------------------------------//
System.Diagnostics.Process encodeProcess = new Process();
encodeProcess.StartInfo = startInfo;
encodeProcess.Start();
//encodeProcess.WaitForExit();
//增加时间限制,取消无限期等待完成。[Sunny Zhao 2006-11-1]
if (encodeProcess.WaitForExit(3000000) == false)
{
if (encodeProcess.Ha***ited == false)
{
encodeProcess.Kill();
encodeProcess.WaitForExit();
}
}
encodeProcess.Dispose();
return Flvmdi(outputFilePath,out fileSize,out playTime);
}
catch(Exception ex)
{
throw ex;
}
}
{
fileSize = 0;
playTime = 0M;
try
{
ProcessStartInfo startInfo = new ProcessStartInfo(Ffmpeg_Path);
startInfo.UseShellExecute = false;
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.Arguments = " -i " + sourceFilePath + " -ab 32k -ar 22050 -b 350k -r 15 -qmin 6 -qmax 20 -s 320x240 -y " + outputFilePath;
//------------------------------------------------------//
//System.Diagnostics.Process.Start(startInfo); //
//此方法无法等待进程完成,所以更新为下面的方式执行。 //
//------------------------------------------------------//
System.Diagnostics.Process encodeProcess = new Process();
encodeProcess.StartInfo = startInfo;
encodeProcess.Start();
//encodeProcess.WaitForExit();
//增加时间限制,取消无限期等待完成。[Sunny Zhao 2006-11-1]
if (encodeProcess.WaitForExit(3000000) == false)
{
if (encodeProcess.Ha***ited == false)
{
encodeProcess.Kill();
encodeProcess.WaitForExit();
}
}
encodeProcess.Dispose();
return Flvmdi(outputFilePath,out fileSize,out playTime);
}
catch(Exception ex)
{
throw ex;
}
}
- ffmpeg used in window with .net
- Drawing in layered window with Direct2D
- Code Naming Conventions Used in 《ASP.NET Unleashed》
- ActionBarImpl can only be used with a compatible window decor layout
- java.lang.IllegalStateException: ActionBarImpl can only be used with a compatible window decor layou
- java.lang.IllegalStateException: ActionBarImpl can only be used with a compatible window decor layou
- Messages Used with Menus
- Messages Used with Menus
- fix screen scrolling in ubuntu xterm when used with GNU screen
- wireshark:no interface can be used for capturing in this system with the current configuration
- How to enter deep idle with USB plugged in (Used For Debugging)
- Calling latest() can only be used in combination with key(String) and keyLike(String)
- ROWNUM used in ORACLE
- Phrases Used In Reports
- Keywords used in resume
- symbol used in shell
- override deal with window closing in database application
- Netbeans Link editor window with file in Project tree
- sql统计之存储过程
- 黑客系列知识之不要小看了ping命令
- 建立手机平台的产品线
- Java,方形按钮
- 惠普全力打造软件品牌 扩产品线增长亚洲业务 --- 软硬件服务整合是未来HP的方向
- ffmpeg used in window with .net
- 2000/XP/2003操作系统常见问题集锦一
- C#从视频截图的方法
- 使用ffmpeg.exe转换flv格式的ASP函数 在asp中的调用
- C控制语句:分支和跳转
- 2000/XP/2003操作系统常见问题集锦二
- 做好欧美外包,要做对三件事
- 用GridView导出Execl
- 地震