InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

ffmpeg tutorials

  • Command line - scale a video using ffmpeg
  • Convert mp3 to ogg on Mac using ffmpeg
  • Install ffmpeg on Ubuntu Linux
  • Mac - how to convert mp4 to webm
 
  • Home
  • > Tutorials
  • > Linux/Unix Command Line
  • > ffmpeg

Convert mp3 to ogg on Mac using ffmpeg

By admin on Sep 25, 2015

Sometimes we need to convert mp3 files to ogg files. Ogg is an open format and produces fairly small size files. Here are the instructions to use ffmpeg on Mac to convert mp3 files to ogg format files.

Install ffmpeg on Mac

We’ll use brew to install ffmpeg on mac:

$ brew install ffmpeg

In case you get error with brew link lame you may have to use the following:

$ brew link --overwrite lame

Convert mp3 to ogg

Use the following command to convert foo.mp3 to foo.ogg

$ ffmpeg -y -i foo.mp3  -strict -2 -acodec vorbis -ac 2 -aq 50 foo.ogg

Batch convert multiple mp3 files to ogg

In case you want to convert multiple mp3 files present in a directory, you can use the following bash script. Save the following code to file convert_m3_to_ogg.sh

#!/bin/bash
for i in *.mp3; do
  j=$(echo -n $i | sed -e 's/.mp3/.ogg/g')
  echo "converting $i  to  $j"
  ffmpeg -y -i "$i"  -strict -2 -acodec vorbis -ac 2 -aq 50 "$j"
done

Now cd to the desired directory run the following:

$ chmod a+x ./convert_m3_to_ogg.sh
$ ./convert_m3_to_ogg.sh

This will create one .ogg file for each .mp3 file in same directory. Make sure you take a backup of your directory before running the script to be on safer side.

Suggested posts:

  1. Python etl petl – read table from csv file
  2. WordPress – query to dump all categories
  3. HTML5 – video tag
  4. mac pkgutil – quick start guide
  5. Get image width and ppi using imagemagick identify on command line
  6. How to create animated gif using Mac preview
  7. How to edit animated gif speed (FPS) using imagemagick convert
  8. Php look ahead and look behind regex examples
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged ffmpeg, Linux/Unix Command Line, Mac, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress