Convert MPG to AVI using ffmpeg.exe in C #

I have a problem converting an MPG file to an AVI file. When I converted a file, such as a 520 KB MPG file, my program generated an AVI file of about 112 MB in size and this video does not work properly. What can cause this?

     string path = "C:\\convert\\input.mpg" 
     string outputpath = "C:\\convert\\"+output+".avi";

     string fileargs = "-i" + " " + path + "  " + outputpath;


        System.Diagnostics.Process p = new System.Diagnostics.Process();
        p.StartInfo.FileName = "C:\\convert\\ffmpeg.exe";
        p.StartInfo.Arguments = fileargs;
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.RedirectStandardOutput = true;
        p.Start();


        p.WaitForExit();
+3
source share
2 answers

I used this for quicktime rewrapping. Not sure if it will work like AVI, but you could leave.

fileargs = String.Format("-i {0} -vcodec copy -acodec copy {1}", path, outputpath);

or, if this does not work, you can try:

fileargs = String.Format("-i {0} -vcodec copy -acodec pcm_s16le {1}", path, outputpath);
+1
source

ffmpeg has a lot . Probably some experimentation is required to get the right settings.

0
source

Source: https://habr.com/ru/post/1776477/


All Articles