user472018
user472018

Reputation: 61

Converting MPG to AVI with using ffmpeg.exe in C#

I have a problem converting an MPG file to an AVI file. When I converted a file, for example 520KB MPG file, my program generated an AVI file of about 112MB and that video does not work properly. What would 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();

Upvotes: 3

Views: 1955

Answers (2)

BlueVoodoo
BlueVoodoo

Reputation: 3686

I have used this for Quicktime rewrapping. Not sure it will work as fine on AVI but you could have a go.

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

or, if that doesn't work, you could try:

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

Upvotes: 1

Jay
Jay

Reputation: 14471

ffmpeg has many options. It will probably take some experimentation to get the correct settings.

Upvotes: 0

Related Questions