How to convert mp4, opus or ogg file in to mp3 using ffmpeg
Question
Convert OGG to MP3
ffmpeg -v 5 -y -i file.m4a -acodec libmp3lame -ac 2 -ab 192k file.mp3
Convert M4A to MP3
ffmpeg -i file.ogg file.mp3
#Or
ffmpeg -i file.{ogg,mp3}
Convert OPUS to mp3 with simpling and bitrate selection
ffmpeg -i input.opus -vn -ar 48000 -ac 2 -b:a 156k output.mp3
Batch process (bulk processing - shell/batch script) examples:
#Example1for i in *.m4a; do ffmpeg -v 5 -y -i "$i" -acodec libmp3lame -ac 2 -ab 192k "mp3/${i%.*}.mp3"; done
#Example2for i in *.ogg; do ffmpeg -i "$i" "mp3/${i%.*}.mp3"; done
#Example 3 : multiple file typefor i in *.{m4a,opus,ogg}; do ffmpeg -i "$i" "mp3/${i%.*}.mp3"; done
Orfor i in *.{m4a,opus,ogg}; do ffmpeg -i "$i" -vn -ar 48000 -ac 2 -b:a 156k "mp3/${i%.*}.mp3"; done
Comments