how can I convert all of the mp4
files in a given folder to mp3
using ffmpeg.
Almost all of the links I have seen on google is all about converting mp4 video to mp3.
I can do this via VLC player but I have got huge collection ~ 1000 mp4 audio files and want this to be done over command line by some script or command.
Is it possible to do it via gstreamer?
One method is a bash for loop.
For converting only .mp4
files:
mkdir outputs
for f in *.mp4; do ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%.mp4}.mp3"; done
For converting .m4a
, .mov
, and .flac
:
mkdir outputs
for f in *.{m4a,mov,flac}; do ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%.*}.mp3"; done
For converting anything use the "*" wildcard:
mkdir outputs
for f in *; do ffmpeg -i "$f" -c:a libmp3lame "outputs/${f%.*}.mp3"; done