Convert audio files to mp3 using ffmpeg
For batch processing with files in folder aiming for 190 VBR and file extension = .mp3 instead of .ac3.mp3 you can use the following code
Change .ac3 to whatever the source audio format is.
ffmpeg mp3 settings
for f in *.ac3 ; do ffmpeg -i "$f" -acodec libmp3lame -q:a 2 "${f%.*}.mp3"; done
1) wav to mp3
ffmpeg -i audio.wav -acodec libmp3lame audio.mp3
2) ogg to mp3
ffmpeg -i audio.ogg -acodec libmp3lame audio.mp3
3) ac3 to mp3
ffmpeg -i audio.ac3 -acodec libmp3lame audio.mp3
4) aac to mp3
ffmpeg -i audio.aac -acodec libmp3lame audio.mp3
You could use this command:
ffmpeg -i input.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3
Explanation of the used arguments in this example:
-i
- input file-vn
- Disable video, to make sure no video (including album cover image) is included if the source would be a video file-ar
- Set the audio sampling frequency. For output streams it is set by default to the frequency of the corresponding input stream. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options.-ac
- Set the number of audio channels. For output streams it is set by default to the number of input audio channels. For input streams this option only makes sense for audio grabbing devices and raw demuxers and is mapped to the corresponding demuxer options. So used here to make sure it is stereo (2 channels)-b:a
- Converts the audio bitrate to be exact 192kbit per second