原文地址:  http://www.open-open.com/lib/view/open1354088827449.html

FFMPEG的.Net封装,FFmpeg.NET

这是FFMPEG库的一个.Net封装,设计为易于使用,并尽可能完整。具有以下功能:

  • Decode of video frames (can save them as BMPs or whatever format GDI+ supports, returns a Bitmap)
  • Decode of audio into PCM (which can then be saved into a WAV file)
  • The release will build into a single assembly - no FFMPEG dlls or any other files! Everything is linked in.
  • Encoding support
  • Some utilitiy classes to wrap WAV files.
  • Weed out the memory leaks.

项目主页:http://www.open-open.com/lib/view/home/1354088827449

相关文章: http://www.cnblogs.com/xiaotie/archive/2013/01/05/2845576.html

视频格式转Flv

using System;
using System.Web;
namespace JumboTCMS.Utils
{/// <summary>/// ffmpeg.exe调用/// </summary>public static class ffmpegHelp{/// <summary>/// 视频格式转为Flv/// </summary>/// <param name="vFileName">原视频文件地址</param>/// <param name="WidthAndHeight">宽和高参数,如:480*360</param>/// <param name="ExportName">生成后的FLV文件地址</param>/// <returns></returns>public static bool Convert2Flv(string vFileName, string WidthAndHeight, string ExportName){try{vFileName = HttpContext.Current.Server.MapPath(vFileName);ExportName = HttpContext.Current.Server.MapPath(ExportName);string Command = " -i \"" + vFileName + "\" -y -ab 32 -ar 22050 -b 800000 -s " + WidthAndHeight + " \"" + ExportName + "\""; //Flv格式   System.Diagnostics.Process p = new System.Diagnostics.Process();p.StartInfo.FileName = @"ffmpeg.exe";p.StartInfo.Arguments = Command;p.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath("~/bin/tools/");#region 方法一//p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序 启动 线程//p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中(这个一定要注意,FFMPEG的所有输出信息,都为错误输出流,用 StandardOutput是捕获不到任何消息的...//p.StartInfo.CreateNoWindow = false;//不创建进程窗口//p.Start();//启动线程//p.BeginErrorReadLine();//开始异步读取//p.WaitForExit();//等待完成//p.Close();//关闭进程//p.Dispose();//释放资源#endregion#region 方法二p.StartInfo.CreateNoWindow = true;p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;p.Start();//启动线程p.WaitForExit();//等待完成p.Close();//关闭进程p.Dispose();//释放资源#endregion}catch (System.Exception e){throw e;}return true;}/// <summary>/// 生成FLV视频的缩略图/// </summary>/// <param name="vFileName">视频文件地址</param>/// <param name="FlvImgSize">宽和高参数,如:240*180</param>/// <returns></returns>public static string CatchImg(string vFileName, string FlvImgSize, string Second){if (!System.IO.File.Exists(HttpContext.Current.Server.MapPath(vFileName)))return "";try{string flv_img_p = vFileName.Substring(0, vFileName.Length - 4) + "_thumb.jpg";string Command = " -i \"" + HttpContext.Current.Server.MapPath(vFileName) + "\" -y -f image2 -ss " + Second + " -t 0.1 -s " + FlvImgSize + " \"" + HttpContext.Current.Server.MapPath(flv_img_p) + "\"";System.Diagnostics.Process p = new System.Diagnostics.Process();p.StartInfo.FileName = @"ffmpeg.exe";p.StartInfo.Arguments = Command;p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;p.StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath("~/bin/tools/");//不创建进程窗口p.StartInfo.CreateNoWindow = true;p.Start();//启动线程p.WaitForExit();//等待完成p.Close();//关闭进程p.Dispose();//释放资源System.Threading.Thread.Sleep(4000);//注意:图片截取成功后,数据由内存缓存写到磁盘需要时间较长,大概在3,4秒甚至更长;if (System.IO.File.Exists(HttpContext.Current.Server.MapPath(flv_img_p))){return flv_img_p;}return "";}catch{return "";}}}
}

FFMPEG的.Net封装,FFmpeg.NET相关推荐

  1. Atitit ffmpeg功能表 多媒体处理类库工具 音频视频 1.1.ffmpeg音视频合成  1.2.Atitit 视频音频分离 提取法 1.3.ffmpeg对视频封装和分离 使用ffmpeg对

    Atitit ffmpeg功能表 多媒体处理类库工具 音频视频 目录 1.1. ffmpeg音视频合成 1 1.2. Atitit 视频音频分离 提取法 1 1.3. ffmpeg对视频封装和分离 1 ...

  2. Python使用Kt封装FFmpeg

    Python使用Tkinter封装FFmpeg 前言:这次实验为2016级北邮信通多媒体通信的一次小作业(版本一&版本二),在此记录一下以供后来的学弟学妹参考,当然也可以使用其他的方式比如Qt ...

  3. FFmpeg开发(五)——Qt视频播放器之封装FFmpeg类(参考了暴风影音、迅雷影音)

    FFmpeg开发(五)--Qt视频播放器之封装FFmpeg类(参考了暴风影音.迅雷影音) 上一篇介绍了,使用Qt和FFmpeg写的播放器.页面大家可以点进去查看和下载. FFmpeg开发(四)--Qt ...

  4. 【C++ 语言】Visual Studio 配置 FFMPEG 开发环境 ( VS2019 CMake 环境安装 | 下载 FFMPEG 开发包 | 配置 FFMPEG )

    文章目录 Visual Studio 2019 社区版 CMakeList 开发环境安装 创建 FFMPEG 配置项目 FFMPEG 开发包下载 FFMPEG 头文件 静态链接库 ( .lib ) 动 ...

  5. ffmpeg 常用基本命令和ffmpeg处理RTMP流媒体的常用命令

    ffmpeg 常用基本命令 1.分离视频音频流 ffmpeg -i input_file -vcodec copy -an output_file_video //分离视频流 ffmpeg -i in ...

  6. FFmpeg从入门:FFmpeg框架

    1. FFmpeg介绍与裁剪 1.1 FFmpeg简介 FFmpeg(Fast forword mpeg,音视频转换器)是一个开源免费跨平台的视频和音频流方案,它提供了录制/音视频编解码.转换以及流化 ...

  7. FFmpeg学习之八(FFmpeg源码编译)

    FFmpeg学习之八(FFmpeg源码编译) Mac下 FFmpeg源码编译 安装 1. 使用终端安装FFmpeg 2. 手动编译 2.1 编译环境 - Xcode 2.2 安装依赖库 2.3 安装F ...

  8. 音视频高级开发——如何快速学习FFmpeg丨ffplay、ffmpeg命令如何编程实现

    如何更快速地掌握FFmpeg 1.为什么要学FFmpeg 2.FFmpeg面向对象思想分析 3.ffplay.ffmpeg命令如何编程实现 4.流媒体服务器要怎么学 [技术分享篇]音视频开发--如何快 ...

  9. CentOS7源码安装ffmpeg,并利用ffmpeg实现音频截取

    下载ffmpeg git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg 下载完成后,进入到下载好的ffmpeg目录中执行configure脚本,并指定编 ...

最新文章

  1. 使用Python,OpenCV进行形态学操作
  2. Linux平台-×××
  3. VC由进程ID获取窗口句柄的各种方
  4. 多线程 空值线程数_【开发者成长】深入理解多线程编程
  5. 云原生架构应该怎么设计?
  6. springboot profile_SpringBoot简单配置
  7. Java DataOutputStream writeByte()方法与示例
  8. python向lt新增5个元素_Python学习第十一课-MOOC嵩天
  9. word页面顺序倒过来_Word里的表格,行之间的顺序如何颠倒过来?
  10. 什么才是真正的价值?
  11. 世界地图可以无限放大_做外贸有哪些软件可以推荐?
  12. 可缩放矢量图形svg
  13. 十分钟教会你们怎么开传奇
  14. 今日分享一些好看的壁纸,有没有你喜欢的
  15. 【转】美剧字幕长讲述她如何练听力的
  16. paper 43 :ENDNOTE下载及使用方法简介
  17. DDC EDID 介绍
  18. 小微企业信用评级方法
  19. Windows 10 MSDN 镜像和版本区别
  20. 安川机器人co文件_Robcad MOTOMAN 安川机器人数模

热门文章

  1. VYSOR-投屏软件
  2. 100以内的质数(素数)
  3. 【matlab图像处理】理想低通滤波器
  4. 张凯复旦大学计算机学院,徐丰 - 师资队伍 - 复旦大学信息科学与工程学院
  5. Linux的账号与权限管理
  6. 【矩阵论】矩阵的相似标准型(1)
  7. 2018年英语专升本英语阅读「Part II 阅读专区」【文章(图片)、答案、词汇记忆】
  8. 端口渗透—23端口Telnet
  9. 直通滤波(PassThrough 过滤器)
  10. php服务器默认首页,如何修改Apache服务器的默认首页?