Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用C#/DirectShow.Net/3ivx在MP4中编码_C#_.net_Directshow_Mp4 - Fatal编程技术网

使用C#/DirectShow.Net/3ivx在MP4中编码

使用C#/DirectShow.Net/3ivx在MP4中编码,c#,.net,directshow,mp4,C#,.net,Directshow,Mp4,我希望在MP4中编码.wmv视频 我在这里使用这个小软件: 我使用DirectShow.Net: 和3ivx编解码器 如何更改代码: // // This method convert the input file to an wmv file // void Convert2Wmv(string fileName) { try { label1.Text = "Encodage";

我希望在MP4中编码.wmv视频

我在这里使用这个小软件:

我使用DirectShow.Net: 和3ivx编解码器

如何更改代码:

    //
    // This method convert the input file to an wmv file
    //
    void Convert2Wmv(string fileName)
    {
        try
        {
            label1.Text = "Encodage";
            button1.Enabled = false;

            hr = me.SetNotifyWindow(this.Handle, WM_GRAPHNOTIFY, IntPtr.Zero);
            DsError.ThrowExceptionForHR(hr);

            // here we use the asf writer to create wmv files
            WMAsfWriter asf_filter = new WMAsfWriter();
            IFileSinkFilter fs = (IFileSinkFilter)asf_filter;

            hr = fs.SetFileName(fileName + ".wmv", null);
            DsError.ThrowExceptionForHR(hr);

            hr = gb.AddFilter((IBaseFilter)asf_filter, "WM Asf Writer");
            DsError.ThrowExceptionForHR(hr);

            hr = gb.RenderFile(fileName + fExt, null);
            DsError.ThrowExceptionForHR(hr);

            hr = mc.Run();
            DsError.ThrowExceptionForHR(hr);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error converting to wmv: " + ex.Message);
        }
    }
有MP4编码吗?我是C/.Net的初学者=$

提前谢谢你3

您可以使用(适用于Mac、Linux和Windows的免费命令行工具)将WMV编码为MP4。下面是一个示例语法:

ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a libfaac -q:a 100 output.mp4

我试过了,但我有一个错误:未知的编码器'libfaac',我可以尝试另一个吗?