1

I am use FFmpeg v4.1 .

How can I convert all '.mp3' files in the "ab1" folder to the "cd2" folder with the same file names as '.mp3'?

The process I'm going to do is:

-acodec libmp3lame -b:a 192k -ar 48000 -map_metadata -1
2

2 Answers 2

1

You can use a bash for loop.

cd ab1
mkdir cd2
for f in *.mp3; do ffmpeg -i "$f" -c:a libmp3lame -b:a 192k -ar 48000 -map_metadata -1 "cd2/${f%.*}.mp3"; done

This assumes your OS supports bash shell scripting.

0

Cross platform solution with Powershell (Cross-platform, but only Windows has powershell installed by default. Mac or Linux users have to install it).

ls "\path\to\source\folder\"|?{$_.extension -match (".mp3")}|%{
  ffmpeg -i $_.fullname -acodec libmp3lame -b:a 192k -ar 48000 -map_metadata -1 ("\path\to\destination\folder\" + $_.name)
}
  • the |?{$_.extension -match (".mp3")} means where the item's extension matches ".mp3" and is only necessary if you have other files in the source folder.

  • "\path\to\source\folder\" or "\path\to\destination\folder\" need to be replaced with, er, the path to the folders. One or the other can be omitted if your current directory is the source folder, or destination folder respectively. This can be an absolute or relative path.

  • to make the folder if it doesn't exist just mkdir "\path\to\destination\folder\" before running the command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.