Convert M4A or OGG audio file in to MP3 on linux | Drupal 8

Convert M4A or OGG audio file in to MP3 on linux

Submitted by editor on Mon, 03/08/2021 - 09:42
Question

How to convert mp4 or ogg file in to mp3 using ffmpeg

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}

 

Batch process (bulk processing - shell/batch script) examples:

#Example1
for i in *.m4a; do ffmpeg -v 5 -y -i "$i" -acodec libmp3lame -ac 2 -ab 192k "mp3/${i%.*}.mp3"; done

#Example2
for i in *.ogg; do ffmpeg -i "$i" "mp3/${i%.*}.mp3"; done

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.