简体   繁体   English

使用C#将视频从Mp4,avi格式转换为wmv格式

[英]Convert video from Mp4 ,avi format to wmv format using C#

I have used Microsoft Expression Encoder to append two videos and this thing works Fine The problem is that when i tried to append videos other than 'wmv' ,it gives exception of FileNot Supported 我已经使用Microsoft Expression Encoder附加了两个视频,这个东西很好用问题是,当我试图追加“wmv”以外的视频时 ,它给出了FileNot支持的例外情况

I searched on google but i was unable to find the solution. 我在谷歌搜索但我无法找到解决方案。

    private void button1_Click(object sender, EventArgs e)
    {

        MediaItem mediaItem1 = null;
        Job job = new Job();
        job.EncodeProgress += new EventHandler<EncodeProgressEventArgs>(job_EncodeProgress);
        int count = 0;
        //video url contains all urls of videos
        foreach (string x in VideosUrls)
        {
            if (count == 0)
            {
                mediaItem1 = new MediaItem(x);

                job.MediaItems.Add(mediaItem1);
            }
            else
            {
                mediaItem1.Sources.Add(new Source(x));
            }
            count++;
        }

        job.OutputDirectory = @"C://videoOutput";
        job.Encode();
    }

Is there any way using AForge.NET or Microsoft Expression Encoder so i can convert any 'mp4' video to 'wmv' programmatically before appending it with no Audio or quality Loss. 有没有办法使用AForge.NETMicrosoft Expression Encoder,所以我可以编程方式将任何'mp4'视频转换为'wmv',然后再添加音频或质量损失。

Thanks a lot for reading all Question :) 非常感谢阅读所有问题:)

I would check which edition of Windows Media encoder you have. 我会检查你有哪个版本的Windows Media编码器。

The "Express Edition" apparently, "does not support H.264 encoding". “Express Edition”显然“不支持H.264编码”。

The reality is you need a license for MP4 encoding from MPEG LA. 实际情况是您需要MPEG LA的MP4编码许可证。 Thats probably why only the paid versions of Expression Encoder support MPEG 4. 这可能就是为什么只有付费版本的Expression Encoder支持MPEG 4。

Logically, you can't convert from one video/audio format to another without loosing quality. 从逻辑上讲,您无法在不失去质量的情况下从一种视频/音频格式转换为另一种格式。 WMV files typically contain video encoded in VC-1 and audio encoded in WMA. WMV文件通常包含以VC-1编码的视频和以WMA编码的音频。 But a .mp4 file typically contains h.264 video and AC-3 audio. 但.mp4文件通常包含h.264视频和AC-3音频。

So, your final .wmv file will need to contain only video in VC-1 which will mean decoding the h.264 video and encoding it in VC-1. 因此,您的最终.wmv文件将只需要包含VC-1中的视频,这意味着解码h.264视频并在VC-1中对其进行编码。 That means quality loss. 这意味着质量损失。

VideoLan can tell you the codecs used inside your .mp4 and .wmv files. VideoLan可以告诉你.mp4和.wmv文件中使用的编解码器。 See this answer . 看到这个答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM