如何将视频从 H.264 转换为 H.265 [英] How to convert video from H.264 to H.265

查看:293
本文介绍了如何将视频从 H.264 转换为 H.265的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 Winform 应用程序,有两个功能:播放视频(使用 vlc videolan 活动插件)并将视频转换为 H.265.但我不知道使用哪个库进行转换(如果可能的话,示例代码).任何人都可以帮助我.感谢并致以最诚挚的问候.

I write a Winform app have 2 function : play video (use vlc videolan active plugin) and convert video to H.265. But I dont know use which library for converting (example code if maybe). Anyone can help me. Thanks and best reagards.

推荐答案

是的,我解决了.我把代码放在这里供任何人需要.首先,下载 https://ffmpeg.zeranoe.com/builds/(选择 Shared),然后将此包中 bin 文件夹中的所有文件复制到您的项目中.接下来,代码:

Yay, I solved it. I put code here for anyone need. First, download https://ffmpeg.zeranoe.com/builds/ (choose Shared), then copy all file in bin folder in this package to your project. Next, code :

string input = "E:\\ii.mp4";
string output = "E:\\oo.mp4";
Process proc = new Process();
proc.StartInfo.FileName = @"E:\\DuyProject\\Format_H264_H265\\ffmpeg\\ffmpeg.exe";
proc.StartInfo.Arguments = "-i " + input + " -c:v libx265 " + output;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.UseShellExecute = false;
if (!proc.Start())
{
    Console.WriteLine("Error starting");
    return;
}
StreamReader reader = proc.StandardError;
string line;
while ((line = reader.ReadLine()) != null)
{
   Console.WriteLine(line);
}
proc.Close();

这篇关于如何将视频从 H.264 转换为 H.265的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆