ubuntu:sound:convert_wav_to_mp3
Table of Contents
Ubuntu - Sound - Convert WAV to MP3
Using ffmpeg
ffmpeg -i "song.wav" -ab 320k "song.mp3"
Batch:
for i in *.wav; do ffmpeg -i "$i" -ab 320k "${i%.*}.mp3"; done
for i in *.wav; do ffmpeg -i "$i" -f mp3 "${i%}.mp3"; done
Mono to stereo conversion:
ffmpeg -i test.wav -af "pan=stereo|c0=c0|c1=c0" out.wav
Strip Video:
ffmpeg -i input.wav -vn -ar 44100 -ac 2 -b:a 192k output.mp3
- -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
Using Lame
High quality
lame -h song.wav song.mp3
Fixed 128kbs stereo encoding
lame song.wav song.mp3
Fast and low quality
lame -f song.wav song.mp3
Encode at a bit rate of 112 kbs
lame -b 112 song.wav song.mp3
Using Bladeenc
bladeenc song.wav song.mp3
NOTE: The size of the MP3 file will be approximately 10% the size of the WAV file.
ubuntu/sound/convert_wav_to_mp3.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1