3

I've been using the code shown below to copy the AAC audio stream from 1 M4A container into a new M4A container.

ffmpeg -i "C:/Example/01 Example Song.m4a" -acodec copy "C:/Example2/01 Example Song.m4a"

I would like to do batch jobs instead of typing the details out for each file. I do NOT want to run a script. The code should do as a I have been, but will copy AAC streams from ALL the M4A files in the directory "C:/Example/" to an output of the same name in "C:/Example2/".

I'm using the 64bit static version of ffmpeg on Windows 8; this is my first time using ffmpeg so I would appreciate it if you'd disect your answer so that I can learn what each bit does.

10
  • You do realize that all batch jobs are a list of commands in a script to be executed by the shell?
    – Vinayak
    Commented Sep 7, 2014 at 4:44
  • What are you exactly trying to do? M4A to M4A copying just the codec - it's an audio stream only so what is ffmpeg actually doing to your files? From what I can see it's simply going to copy the file to your new folder...?
    – Kinnectus
    Commented Sep 7, 2014 at 4:54
  • @Vinayak I guess we operate off differing definitions; to me a batch job is a task to be applied to multiple items. A script is a file that you save a commands to (such as those used in a batch job). To clarify my posting, I do not want to create a file (eg: a bat script) as I will be typing the ffmpeg code into the terminal by hand.
    – Robin Hood
    Commented Sep 7, 2014 at 5:00
  • If you're going to type out the FFMPEG command, what exactly are you hoping to automate here?
    – Vinayak
    Commented Sep 7, 2014 at 5:12
  • 1
    To set the path, use something like this: forfiles /P "D:\Music\input" /C "cmd /c ffmpeg -i @file -acodec copy ..\output\\@file-out.mp3". This assumes that you already have a folder named output under *D:\Music*
    – Vinayak
    Commented Sep 7, 2014 at 5:57

1 Answer 1

2

You can use the FORFILES command for this. FORFILES only works in Windows Vista and later versions though.

forfiles /P "D:\Music\input" /C "cmd /c ffmpeg -i @file -acodec copy ..\output\\@file.mp3"

This is assuming you already have a folder named output under D:\Music\

1
  • You can specify a full output directory location too if desired. forfiles /P "C:\Example" /C "cmd /c ffmpeg -i @file -acodec copy C:\Example2\\@file"
    – Robin Hood
    Commented Sep 7, 2014 at 6:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .