R
R
ruslan25702020-08-20 12:02:49
linux
ruslan2570, 2020-08-20 12:02:49

How to compress all mp3 files in a directory using ffmpeg?

To compress one file I use this command:

ffmpeg -i ~/Music/file.mp3 -q:a 9 ~/Music_compress/file.mp3

How can I do this for all files in the '~/music' directory?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SOTVM, 2020-08-20
@ruslan2570

cd ~/Music ;
mkdir -p Music_compress ;
find  -maxdepth 1 -iname "*.mp3" -type f -exec ffmpeg -i {} -q:a 9 Music_compress/{} \;

R
ruslan2570, 2020-08-20
@ruslan2570

for f in *.mp3; do ffmpeg -i "$f" -q:a 9 "Music_compress/${f%.*}.mp3"; done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question