Convert ogg(/mp3/m4a) Files to m4a(/ogg/mp3) Files Using DOS Command/ Batch Files

If you have a need to convert multiple *.ogg files into *.m4a files, it is not easily possible. I have found a way to quickly convert all ogg files into m4a files. In fact, you can convert any audio file formats to any other format using a DOS bat file.


You should have ffmpeg installed on your computer. In my example, I am using Windows machine and Windows batch file.

Assume that ffmpeg executable is available at C:\Programs\ffmpeg\bin\ffmpeg.exe after install.

Command File “convert.bat”

Create a new bat file called “convert.bat” in the folder where you have all the ogg files.

Copy the following content and paste it into “convert.bat” and save the file.

for /f %%a IN ('dir /b *.ogg') do call "C:\Programs\ffmpeg\bin\ffmpeg.exe" -y -i %%~na.ogg %%~na.m4a

Now save the file and double click on it to execute the file.

Once done, you will have m4a files available in the same folder.

Command Explanation

dir /b *.ogg command lists all the ogg files available in the directory and loops through it. Within loop, %%~na represents the file name without extension. For each file, it executes following command.

 "C:\Programs\ffmpeg\bin\ffmpeg.exe" -y -i MY_FILE.ogg MY_FILE.m4a

-y switch indicates overwriting the file if it exists.

You may change batch file as per your need to convert any music file format to any other format.



Leave a Reply

Your email address will not be published. Required fields are marked *