Useful ffmpeg functions

Extracting audio from a video

I've had problems using ffmpeg to extract audio from a video and having the audio file be much, much larger than it should. For example, 77 MB for 30 minutes of sound. This ffmpeg command did the trick.

ffmpeg -i nature-sounds.mp4 -ss 00:02:00 -vn -ar 44100 -ac 2 -b:a 32k nature-sounds.mp3

The ‑ss 00:02:00 was used to delay recording until two minutes into the video to prevent recording an undesireable sound. The ‑b:a 32k is where the bit rate is set. In this particular case, the audio included high-pitched sounds (birds chirping) so the 32k bit rate was needed. If your audio is, say, human voices, you might get away with 16k but it may not decrease the file size significantly.