Windows – Execute Task on All Files in Directory Recursively

bashffmpegscriptwindows

I have a huge number of mp4 video files that needs to have a volume boost. I need a way to execute a ffmpeg audio filter on all files in a specified base directory (and in subdirectories as well). My problem is that I'm working on a Windows computer and I have no knowledge of its shell syntax.

I would like to do the equivalent of what this bash script does :

TARGET_FILES=$(find /path/to/dir -type f -name *.mp4)
for f in $TARGET_FILES
do
  ffmpeg -i $f -af 'volume=4.0' output.$f
done

I spent quite some time this afternoon looking for a solution but the recursive nature of what I need (that is so simple with find!) isn't too clear.

Any help would be greatly appreciated!

Best Answer

In short, your script translates to the command-prompt one-liner:

for /r "C:\path\to\file" %f in (*.mp4) do ffmpeg -i %f -af 'volume=4.0' output.%f

Explained: for command loops over all files that meet certain criteria and execute command after do. /r means recursive (i.e. search into subfolders); %f is arbitrary variable similar to $f in your script. Other parts should be self-explanatory.

Related Question