C# ffmpeg 视频处理格式转换具体案例


C# ffmpeg 视频处理格式转换

C# ffmpeg 视频处理格式转换avi到MP4格式

1、代码如下:

 

using System;
using System.Diagnostics;

namespace LongtengSupremeConsole
{
    class Program
    {     
        static void Main(string[] args)
        {           
            string para = $"ffmpeg -i 123.avi 11233.mp4";
            RunProcess(para);          
            Console.WriteLine("完成!");
            Console.ReadKey();
        }

        static void RunProcess(string Parameters)
        {
            var p = new Process();
            p.StartInfo.FileName = "CMD";
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.RedirectStandardError = true;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.Arguments = Parameters;
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.CreateNoWindow = true;
            p.Start();
            p.StandardInput.WriteLine(Parameters);
            Console.WriteLine("\n开始转码...\n");
            //p.WaitForExit();
            // p.Close();
        }
    }
}

2、首先debug生成Debug,然后把下载的ffmpeg.exe(可以到https://ffmpeg.org/download.html下载,)拷贝到Debug下,直接运行程序就可以了

 

3、运行效果如下:


4、ffmpeg下载

第一种: https://ffmpeg.org/download.html,可以看到源码和build版本


第二种:https://ffmpeg.zeranoe.com/builds/,直接下载编译版本

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM