[FFmpeg-user] About audio convert

暗夜龙凌 anyelongling at hotmail.com
Wed May 22 04:49:56 CEST 2013


Firstly, I am costing your time,but it’s really emergency.
I am developing a program about audio convert,it’s my graduation design for my university.
I use C# call avconv to work it out,but it’s not work.
Here is my call function:
public static void ExcuteProcess(string exe, string arg)  
        {
            System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(exe, arg);
            p.UseShellExecute = false;    
            p.CreateNoWindow = true; 
            p.RedirectStandardError = true; 
            p.RedirectStandardOutput = true;
            System.Diagnostics.Process listFiles;
            listFiles = System.Diagnostics.Process.Start(p);
            System.IO.StreamReader myOutput = listFiles.StandardOutput;
            System.IO.StreamReader myOut = listFiles.StandardError;
            listFiles.WaitForExit();
            if (listFiles.HasExited)
            {
                output = myOutput.ReadToEnd();
                errorput = myOut.ReadToEnd();
            } 
        }  
Here is my code:
string in_file = "D:\\One.mp3";
            string out_file = "D:\\test.wav";
            //Boolean ret = false;
            //ret = convertAudio(in_file, out_file);
            //if (!ret)
            //    MessageBox.Show("failed!");
            //else
            //    MessageBox.Show("succeed!");

            try  
            {
                ExcuteProcess("ffmpeg.exe", String.Format("avconv -i {0} -ar 44100 {1}", in_file,out_file));  
                //转换完成 
                MessageBox.Show("转换完成"); 
            }  catch (Exception ex) { 
                MessageBox.Show(ex.ToString());
            }
            textBox1.Text = output+errorput;
And the output be null,errorput not null when I debug the program,
the debug information:
avconv version 9.5, Copyright (c) 2000-2013 the Libav developers
  built on Apr 21 2013 23:16:50 with gcc 4.7.2 (Gentoo 4.7.2 p1.3, pie-0.5.5)
[mp3 @ 0225F960] max_analyze_duration reached
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, mp3, from 'D:\One.mp3':
  Metadata:
    title           : Only One
    album           : Only One (The 7th Album)
    artist          : BoA
  Duration: 00:03:37.20, start: 0.000000, bitrate: 128 kb/s
    Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Unable to find a suitable output format for 'avconv'
I don’t  understand why it find output format for ‘avconv',so would you please help me work it out?
P.S.:when I  run the program separately with cmd.exe,it’s work for converting,so I think it’s wired.
Looking forward to your reply.
                                                                                            Sincerely 
                                                                                            Lulu Lei


More information about the ffmpeg-user mailing list