ffmpegmp3gstreameravaudioplayermp4

converting all the mp4 audio files in a folder to mp3 using ffmpeg


how can I convert all of the mp4 files in a given folder to mp3 using ffmpeg. Almost all of the links I have seen on google is all about converting mp4 video to mp3. I can do this via VLC player but I have got huge collection ~ 1000 mp4 audio files and want this to be done over command line by some script or command. Is it possible to do it via gstreamer?


Solution

  • FileInfo[] Files = d.GetFiles("*.mp4").Union(d.GetFiles("*.<any other file extension>")).ToArray(); 
    
    foreach (FileInfo file in Files)
    {
        // str = str + ", " + file.Name;
        builder.Append(Path.GetFileNameWithoutExtension(file.Name));
    
        ProcessStartInfo startInfo = new ProcessStartInfo();
        startInfo.CreateNoWindow = false;
        startInfo.UseShellExecute = false;
        startInfo.FileName = "ffmpeg.exe";
        startInfo.WindowStyle = ProcessWindowStyle.Hidden;
        startInfo.RedirectStandardOutput = !string.IsNullOrEmpty("test");
        startInfo.Arguments = "-i " + filename + ".mp4 -q:a 0 -map a " + filename + ".mp3";
    }