MP4 To MP3 Converter FFMPEG Linux
Page 1 of 1 • Share •
MP4 To MP3 Converter FFMPEG Linux
Vid
Code
Code
#!/bin/bash
#needs ffmpeg installed
# sudo apt install -y ffmpeg
#
# Usage:
#
# ./mp4tomp3_all.sh test (folder for mp4 sourcefiles).
#
#
# cp -a /$1/. /$2/ #copy the whole dir from src to dest if required!
cd test
#cd $2 #change dir to dest
#cd $2
#convert *.mp4 to *.mp3
#find . -name "*.mp4" -exec bash -c 'var=${1%.mp4}; var=${var#*/};ffmpeg -i "${1#*/}" -vn -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 "$dest/$var".mp3' - '{}' \;
#
find . -name "*.mp4" -exec bash -c 'ffmpeg -i "$1" -vn -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 "${1%.mp4}".mp3' - '{}' \;
#
echo "Cleaning up"
#
find . -name "*.mp4" -exec bash -c 'var=${1%.mp4}; var=${var#*/}; rm "${1#*/}"' - '{}' \;
cd test
mv *.mp3 ../output
#
# mv -b *.mp3 output
echo "Checking for files in Output Files"
if [ ! "$(ls -A ../output)" ]
then
echo "Failed!!"
else
echo "Mission Complete Check Output folder!"
cd ../output
ls
fi
echo "Task Finished All MP4 Should Now Be MP3."
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum