/// <summary>
/// 视频合并
/// </summary>
/// <param name="File1">第一个视频地址</param>
/// <param name="File2">第二个视频地址</param>
/// <param name="DstFile">合成后存放路径</param>
/// <returns></returns>
static string Combine(string File1, string File2, string DstFile)
{
string strTmp1 = File1 + ".ts";
string strTmp2 = File2 + ".ts";
string strCmd1 = " -i " + File1 + " -c copy -bsf:v h264_mp4toannexb -f mpegts " + strTmp1 + " -y ";
string strCmd2 = " -i " + File2 + " -c copy -bsf:v h264_mp4toannexb -f mpegts " + strTmp2 + " -y "; //string strCmd = " -i concat:\"" + strTmp1 + "|" +
//strTmp2 + "\" -c copy -bsf:a aac_adtstoasc -movflags +faststart " + DstFile + " -y ";
string strCmd = " -i \"concat:" + strTmp1 + "|" + strTmp2 + "\" -c copy -bsf:a aac_adtstoasc -movflags +faststart " + DstFile + " -y "; //转换文件类型,由于不是所有类型的视频文件都支持直接合并,需要先转换格式
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "D:\\Work\\tpp20190322\\uploadtemp\\ffmpeg.exe";//要执行的程序名称
p.StartInfo.Arguments = " " + strCmd1;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = false;//可能接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = false;//由调用程序获取输出信息
p.StartInfo.RedirectStandardError = false;//重定向标准错误输出
p.StartInfo.CreateNoWindow = false;//不显示程序窗口 p.Start();//启动程序
p.WaitForExit(); //转换文件类型,由于不是所有类型的视频文件都支持直接合并,需要先转换格式
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "D:\\Work\\tpp20190322\\uploadtemp\\ffmpeg.exe";//要执行的程序名称
p.StartInfo.Arguments = " " + strCmd2;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = false;//可能接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = false;//由调用程序获取输出信息
p.StartInfo.RedirectStandardError = false;//重定向标准错误输出
p.StartInfo.CreateNoWindow = false;//不显示程序窗口 p.Start();//启动程序
p.WaitForExit(); //合并
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "D:\\Work\\tpp20190322\\uploadtemp\\ffmpeg.exe";//要执行的程序名称
p.StartInfo.Arguments = " " + strCmd;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = false;//可能接受来自调用程序的输入信息
p.StartInfo.RedirectStandardOutput = false;//由调用程序获取输出信息
p.StartInfo.RedirectStandardError = false;//重定向标准错误输出
p.StartInfo.CreateNoWindow = false;//不显示程序窗口 p.Start();//启动程序 //向CMD窗口发送输入信息:
// p.StandardInput.Write("ipconfig"); //string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();//等待程序执行完退出进程
//-ss表示搜索到指定的时间 -i表示输入的文件 -y表示覆盖输出 -f表示强制使用的格式 if (System.IO.File.Exists(DstFile))
{
return DstFile;
}
return "";
}

ffmpeg 视频合并的更多相关文章

  1. 使用FFMPEG进行一些视频处理(C#)视频合并、转码、获取时长

    FFMPEG的强大无需多说,举几个用到的功能,直接贴代码了 还有更多命令用到时搜索即可 视频转码 ) { var args = "-y -i {0} -vcodec copy {1}&quo ...

  2. FFmpeg将多张图片合成视频 子视频合并

    FFmpeg将多张图片合成视频 - CSDN博客 https://blog.csdn.net/wangshuainan/article/details/77914508 Slideshow – FFm ...

  3. Android 音视频深入 二十一 FFmpeg视频剪切

    视频剪切我意外的发现上一次的视频压缩的代码能够运行FFmpeg视频剪切的命令,但是不能做视频合并的命令,因为不能读取记录了几个视频的路径的txt文件. 这里我就说直说视频剪切的过程,不说代码,只说lo ...

  4. 使用ffmpeg实现合并多个音频为一个音频的方法

    使用ffmpeg实现合并多个音频为一个音频的方法可以使用ffmpeg的filter功能来进行这个操作,而且效果很好amerge也可以实 使用ffmpeg实现合并多个音频为一个音频的方法 可以使用ffm ...

  5. 使用ffmpeg批量合并flv文件

    title: 使用ffmpeg批量合并flv文件 toc: false date: 2018-10-14 16:08:19 categories: methods tags: ffmpeg flv 使 ...

  6. node ffmpeg 视频操作

    1,先安装ffmpeg 2,设置环境变量 3,npm install fluent-ffmpeg 4,编码 var ffmpeg = require('fluent-ffmpeg'); //视频合并 ...

  7. c# ffmpeg视频转换

    c#  ffmpeg视频转换 什么是ffmpeg,它有什么作用呢,怎么可以使用它呢,带着问题去找答案吧!先参考百度百科把,我觉得它很强大无奇不有,为了方便大家我就把链接提供了! http://baik ...

  8. c# ffmpeg视频转换【转载】

    c#  ffmpeg视频转换 什么是ffmpeg,它有什么作用呢,怎么可以使用它呢,带着问题去找答案吧!先参考百度百科把,我觉得它很强大无奇不有,为了方便大家我就把链接提供了! http://baik ...

  9. C# 使用ffmpeg视频截图

    <appSettings> <add key="ffmpeg" value="E:\ffmpeg\ffmpeg-20141012-git-20df026 ...

随机推荐

  1. pip 将 某包指定到某目录 安装

    pip 将 某包指定到某目录  安装: pip install --target=d:\somewhere\other\than\the\default package_name

  2. GPUtil是一个Python模块,使用nvidia-smi从NVIDA GPU获取GPU状态

    GPUtil是一个Python模块,使用nvidia-smi从NVIDA GPU获取GPU状态 一个Python模块,用于在Python中使用nvidia-smi以编程方式从NVIDA GPU获取GP ...

  3. logback 打印mybatis sql mybatis 日志打印sql语句和返回结果

    logback 打印sql语句: 在logback日志文件中开启debug模式 <logger name="com.ibatis" level="DEBUG&quo ...

  4. H3C 面向连接和无连接的服务

  5. 在linux上安装pear

    在搭建centreon的过程中,需要pear模块支持. 什么是pear pear是PHP扩展与应用库(the PHP Extension and Application Repository)的缩写. ...

  6. Vue之webpack的entry和output

    一.文件结构 二.index.html <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  7. Python--day46--分组(看了别人博客掌握的)

    原文链接:https://www.cnblogs.com/snsdzjlz320/p/5738226.html group by group by + group_concat() group by ...

  8. Python--day40--threading模块

    import time from threading import Thread class MyThread(Thread): def __init__(self,arg): super().__i ...

  9. word 筛选过的网页,网页,单个文件网页

    1)筛选过的网页:保存后会生成 xxx.htm和xxx.files文件夹,删除了还原成Word文档所需的格式标记和功能,也就是说存为纯网页了,文件尺寸小:2)网页:保存后会生成 xxx.htm和xxx ...

  10. java 利用反射创建对象

    创建对象: 1.使用Class对象的newInstance()方法创建该Class对象的实例,此时该Class对象必须要有无参数的构造方法. 2.使用Class对象获取指定的Constructor对象 ...