How to convert video from H.264 to H.265

2019-09-21 19:05发布

问题:

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.

回答1:

You can use FFMpeg with this command:

ffmpeg -i input.mp4 -c:v libx265 output.mp4


回答2:

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();


回答3:

That's awesome, if anyone feel hard to understand then use Pavtube video converter can convert any video to any format easily. this software is stable and keep updating for users.