Happy Easter everyone. Another weekend and another Linux article. In this article, I go through how to record podcasts with FFmpeg.
The first thing to pass is the input file format with -f
. For audio there are three options:
oss
– legacy Linux audio driver (not used anymore)alsa
– newer audio driverpulse
– most recent driver that’s used in modern Linux distributions
After that, you need to set the input using -i
. That’s the tricky part because depends on your driver, the parameter would be different.
Configure Alsa
For alsa you need to pass something like this,
$ ffmpeg -f alsa -i hw:0,1
Where 0
points to the card number and 1
points to device number.
But how to get it? You can use arecord -l
. Since the number may change with each reboot, it’s better to pass the device name instead.
To get device name run arecord -L
and the pass the value you want in front of -i
.
Configure Pulse
For pulse audio, you need to get the device number using pacmd list-sources
and then set the index in front of -it
parameter.
$ ffmpeg -f pulse -i 2
Channel setting
You can set the channel with -ac
parameter. For stereo use 2
for mono 1
.
$ ffmpeg -f pulse -i 2 -ac 2
Codec setting
To set the audio codec use either -c:a
or -acodec
. My recommendation is to use libmp3lame
. Of course, you are not limited to that. There are many options like flac
, aac
, etc.
$ ffmpeg -f pulse -i 2 -ac 2 -acodec libmp3lame
Bitrate setting
Finally set the bitrate with -ab
parameter. For very high-quality audio use -ab 320k
. For standard use either -ab 128k
or -ab 160k
.
$ ffmpeg -f pulse -i 2 -ac 2 -acodec libmp3lame -ab 320k out.mp3
That’s all you need to record podcasts using FFmpeg. Hope you enjoy it.
If you want to see more videos, don’t forget to check my YouTube channel or check the YouTube category of the site at the links below,