FFmpeg: command line and GUI audio/video conversion tool: audio references

FFmpeg can be used for both video and audio conversion and stream manipulation; this page records some useful links for audio work with FFmpeg.

The reality is that I mostly use other Mac GUI tools like XLD (X Lossless decoder), Freac, Max etc. for converting, but I do find ffmpeg command line useful for tricky situations, and you can use it to make a nice and very quick audio statistics command line tool for checking RMS values and peaks in files (so that you can then decide whether or not they should be normalised, without having to load them in a sound editing app).

Command line ffmpeg

Command line 'ffmpeg' for Mac can be installed using MacPorts. I got it working OK on Mac OS X Mountain Lion, but you should at least be a bit UNIX savvy to try this. You will also need the LAME MP3 Encoder port if you want to deal with MP3.

$ sudo port install ffmpeg

$ sudo port install lame

(As always with mac ports, don't be scared to use that -f (force) option if you upgraded your os recently !)

FFmpegX is a rather clunky but nevertheless very powerful GUI for FFmpeg for Mac OS X. For some reason I could not get it to work with FLAC lossless compression files, but the command line version works with FLAC.

Useful FFmpeg links for audio:

- Audio options

- Video and audio file format conversion

- Rodrigo Polo's FFmpeg cheat sheet.

- FFmpeg basics for beginners

- An amazingly comprehensive 6-part series from 2011/2012 by Fabio Sonnati FFmpeg: the swiss army knife of Internet Streaming.

Supported audio types. You can also use command line:

$ffmpeg -codecs
$ ffmpeg -formats

Making a simple audio statistics analyzer

Store the following in a file at ~/bin/@ffmpeg-statistics:

ffmpeg -i "$1" -filter:a "volumedetect" -vn -f null /dev/null

Make sure you make it executable with:

chmod +x ~/bin/@ffmpeg-statistics'.

And do "quote" your audio file name if it contains spaces:

@ffmpeg-statistics "my audio file.mp3"

Output is like:

Duration: 00:05:32.43, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Output #0, null, to '/dev/null':
encoder : Lavf55.12.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 -> pcm_s16le)
size=N/A time=00:05:32.43 bitrate=N/A
video:0kB audio:57263kB subtitle:0 global headers:0kB muxing overhead -100.000038%
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] n_samples: 29318494
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] mean_volume: -17.1 dB
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] max_volume: -1.4 dB
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] histogram_1db: 12
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] histogram_2db: 583
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] histogram_3db: 9111
[Parsed_volumedetect_0 @ 0x7f8fa8412d00] histogram_4db: 42170

There are lot sof example of the use of FFmpeg for command line processing, including using the new EBU R128 loundness filter "ebur128", at: A summary of a review of music levels for broadcasting, personal use, recording and mastering, including the new LOUDNESS measures.