Jump to content

batch file to convert wav/flac to alac


Recommended Posts

I have created the following batch file to use ffmpeg to convert flac/wav files to /m4a files that can be played on my ipod... I will later use this script as a template to convert files to flac, wav, mp3, etc.

Anyways, when I run this script, and i drag 2 files onto the batch file (example 1.flac and 2.flac) they both output a filename of 1.m4a instead of 1.m4a and 2.m4a. Thus, I can only convert one file at a time. Is there anyway to fix this so that the output filename will be the same as the input for seperate files?

for %%A in (%*) DO (ffmpeg -i %1 -acodec alac "%~dpn1".m4a)
pause

Link to comment
Share on other sites


Anyways, when I run this script, and i drag 2 files onto the batch file (example 1.flac and 2.flac) they both output a filename of 1.m4a instead of 1.m4a and 2.m4a. Thus, I can only convert one file at a time. Is there anyway to fix this so that the output filename will be the same as the input for seperate files?

for %%A in (%*) DO (ffmpeg -i %1 -acodec alac "%~dpn1".m4a)
pause

Try this:

FOR %%A IN (%*) DO ffmpeg -i "%%~A" -acodec alac "%%~dpnA.m4a"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...