Everyone at some point wanted or would like to convert mp4 to mp3 on Linux. If you would like to achieve that on any Linux system, don’t worry because I’ve a good solution for you.
I wrote a simple bash script to convert mp4 to mp3 on Linux. The script will convert mp4, mkv and webm video formats to mp3 audio format.
You’ll have small assignment of finding out how to get ffmpeg and lame on your distribution.
For Arch Linux users, install Prerequisites; ffmpeg and lame by:
# pacman -S lame ffmpeg
If you believe you’re a Linux guru, you can install ffmpeg from source using link below.
Convert mp4 to mp3 on Linux:
Download the script from github
Script github link: https://github.com/NerdJK23/dotfiles/blob/master/scripts/mp3con.sh
You can as well copy below script snippet.
Make the script executable:
# chmod +x mp3con.sh
Execute script, ( You can do it in the folder containing mp4 videos)
# sh mp3con.sh
You’ll see something similar to below
Since I’m running the script inside the directory with Video files I’ll like to convert to mp3, I’ll go with option 1. Press enter and wait for it to finish.
After successful conversion, the resulting audio files will be saved under ~/Music directory with folder name being the name of previous folder containing video files with the extension -mp3 at the end.
If you do an ls in your ~/Music directory, you should see new folder added. This was a short tutorial on how to convert mp4 to mp3 on Linux. hope it was helpful.