第一步  
On CentOS/RHEL 6.*:
  $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
On CentOS/RHEL 7:
  $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
  $ yum repolist
第二步:yum install ffmpeg
安装后,查看版本,来进行是否安装成功判断;(用whereis ffmpeg可以查看其安装路径;)

/usr/bin/ffmpeg -version
 /// <summary>
/// 获取视频首帧图
/// </summary>
/// <param name="vediofilepath"></param>
/// <param name="directImagedirectory"></param>
/// <param name="ffmpegpath"></param>
/// <returns></returns>
public static string GetVedioFirstImage(string vediofilepath, string directImagedirectory, string ffmpegpath)
{
if (string.IsNullOrEmpty(vediofilepath))
{
return string.Empty;
}
string str_CommandArgs = "";
var file1 = new FileInfo(vediofilepath);
if (file1.Exists)
{
try
{
//string save_folder = file1.FullName.Replace(file1.Name, "");
//string image_file = "video_" + file1.Name.Replace(file1.Extension, ".jpg");
var basepath = directImagedirectory + DateTime.Now.ToString("yyyyMMdd") + "/";
if (!Directory.Exists(directImagedirectory))
{
Directory.CreateDirectory(directImagedirectory);
}
if (!Directory.Exists(basepath))
{
Directory.CreateDirectory(basepath);
}
//string image_file = "video_" + file1.Name.Replace(file1.Extension, ".jpg");
string image_file = basepath + Guid.NewGuid().ToString("N") + ".jpg";
//#设置参数以直接输出图像序列(帧),第2秒
//str_CommandArgs = "-i " + vediofilepath + " -ss 00:00:02 -vframes 1 -an -y -f mjpeg " + image_file;
str_CommandArgs = "-i " + vediofilepath + " -y -f image2 -ss 1 -vframes 1 " + image_file;
System.Diagnostics.ProcessStartInfo cmd_StartInfo = new System.Diagnostics.ProcessStartInfo(ffmpegpath, str_CommandArgs);
cmd_StartInfo.RedirectStandardError = false; //set false
cmd_StartInfo.RedirectStandardOutput = false; //set false
cmd_StartInfo.UseShellExecute = false; //set true
cmd_StartInfo.CreateNoWindow = true; //don't need the black window
//创建一个进程,分配它的ProcessStartInfo并启动它
System.Diagnostics.Process cmd = new System.Diagnostics.Process();
cmd.StartInfo = cmd_StartInfo;
cmd.Start();
cmd.WaitForExit();
//System.Threading.Thread.Sleep(1000); return image_file;
}
catch (Exception ee)
{
throw new Exception(ee.StackTrace + ee.Message + " for: " + vediofilepath + " " + str_CommandArgs);
}
}
else
{
return string.Empty; }
}

netcore linux ffmpeg 首帧图的更多相关文章

  1. C#视频取帧图

    由于项目里页面有许多视频资料需要展示给用户查看,因此需要做一个视频列表,原设计是列表显示视频第一帧图,但实际上很多视频第一帧是纯黑底色. 于是想到用js利用canvas截图,最后发现由于浏览器跨域限制 ...

  2. Java截取视频首帧并旋转正向

    package test; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Image; import j ...

  3. Linux下用火焰图进行性能分析【转】

    转自:https://blog.csdn.net/gatieme/article/details/78885908 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原 ...

  4. linux + ffmpeg + eclipse 调试

    使用linux + ffmpeg + eclipse调试步骤OS : ubuntu 12.04Eclipse : 3.7.2 为Eclipse安装cdt插件,使其支持c/c++ 导入ffmpeg项目 ...

  5. (转)Linux 系统性能分析工具图解读(一、二)

    Linux 系统性能分析工具图解读(一.二) 原文:http://oilbeater.com/linux/2014/09/08/linux-performance-tools.html 最近看了 Br ...

  6. Linux基础命令层级图-01

    Linux基础命令层级图-01:

  7. Linux架构思维导图

    Linux架构思维导图 GUI(Graphical User Interface,图形用户界面) Linux学习路径 软件框架 Linux桌面介绍 FHS:文件系统目录标准 Linux需要特别注意的目 ...

  8. Linux ffmpeg命令的介绍与使用

    ffmpeg使用语法 ffmpeg [[options][`-i' input_file]]... {[options] output_file}... 如果没有输入文件,那么视音频捕捉(只在Linu ...

  9. linux ffmpeg编译配置安装详解

    http://www.111cn.net/sys/linux/53039.htm ffmpeg是一开源的可跨平台使用的一个图形处理插件,这可以进行录制.转换以及流化音视频,同时可以对视频进行截图,下面 ...

  10. FFmpeg原始帧处理-滤镜API用法详解

    本文为作者原创,转载请注明出处:https://www.cnblogs.com/leisure_chn/p/10429145.html 在FFmpeg中,滤镜(filter)处理的是未压缩的原始音视频 ...

随机推荐

  1. SqlSugar常见问题汇总

    1.已有打开的与此 Command 相关联的 DataReader,必须首先将它关闭. There is already an open DataReader associated with this ...

  2. json扩展之自定义序列化方式

    简介:由于json.dumps() 只能序列化Python基本数据类型,如果我们想要在数据中掺杂时间对象,或者自定义类的对象则会造成序列化数据的失败,因此json.dumps() 提供了一个属性 cl ...

  3. 音乐播放器 — 用 vant4 中的滑块自定义播放器进度条

    一.运行效果 二.代码实现 2.1.HTML: <!-- 音频播放器 --> <audio ref="audio" src="音乐名称.mp3" ...

  4. 【预定义】C语言预定义代码(宏、条件编译等)内容介绍【最全的保姆级别教程】

    浅谈C语言预定义中的预定义符号,#define,以及符号#,##的相关运用 求个赞求个赞求个赞求个赞 谢谢 先赞后看好习惯 打字不容易,这都是很用心做的,希望得到支持你 大家的点赞和支持对于我来说是一 ...

  5. Typora Mac中文破解版获取

    作为程序员,markdown是非常好用的文本编辑语言,而Typora是非常好用的一款markdown编辑工具.Typora提供读者和作家的无缝体验.它删除了预览窗口,模式切换器,降低源代码的语法符号以 ...

  6. 【译】VisualStudio 17.9预览3带来了令人兴奋的代码搜索改变

    随着 VisualStudio17.9预览版3的发布,我们为代码搜索(也称为 All-In-One Search)带来了一些令人兴奋的增强.自从我们上次更新搜索体验以来,我们一直在努力改进体验,并想出 ...

  7. Linux-双网卡绑定bond详解

    1.什么是bond 网卡bond是通过多张物理网卡绑定为一个逻辑网卡,实现本地网卡的冗余,带宽扩容和负载均衡,在生产场景中是一种常用的技术.Kernels 2.4.12及以后的版本均供bonding模 ...

  8. python-比较两个列表中的相同元素和不同元素

    由于两个列表(List)中可能会存在重复的元素,所以我们可以将列表转化成集合(set)进行去重,然后计算交集和差集. A = ['1','2','3'] B = ['2','4','5'] ##计算交 ...

  9. offline 2 online | 重要性采样,把 offline + online 数据化为 on-policy samples

    论文标题:Offline-to-Online Reinforcement Learning via Balanced Replay and Pessimistic Q-Ensemble CoRL 20 ...

  10. Spring Boot + MyBatis-Plus 实现 MySQL 主从复制动态数据源切换

    MySQL 主从复制是一种常见的数据库架构,它可以提高数据库的性能和可用性.动态数据源切换则可以根据业务需求,在不同场景下使用不同的数据源,比如在读多写少的场景下,可以通过切换到从库来分担主库的压力. ...