2010-11-23 15 views
3

J'ai un problème lors de la conversion d'un fichier MPG en fichier AVI. Lorsque j'ai converti un fichier, par exemple 520 Ko de fichier MPG, mon programme a généré un fichier AVI d'environ 112 Mo et cette vidéo ne fonctionne pas correctement. Qu'est-ce qui causerait ça?Conversion de MPG en AVI avec l'utilisation de ffmpeg.exe en C#

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

Essayez de lire la ligne de commande commutateurs avec des exemples et vous allez découvrir quelque chose. BTW, votre problème n'a rien à voir avec C#, votre code est OK. –

Répondre

0

ffmpeg a beaucoup options. Il faudra probablement quelques expérimentations pour obtenir les bons paramètres. Je l'ai utilisé pour le réemballage Quicktime

1

Je ne suis pas sûr que cela fonctionnera aussi bien sur AVI mais vous pouvez essayer.

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

ou, si cela ne fonctionne pas, vous pouvez essayer:

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