How do I use ffmpeg to trim silence in a mp3 file?

We need to trim silence from mp3 files and since we're already using ffmpeg to perform some conversions, we prefer to use it to do the trimming too.

Is this possible? I can't find any reference about using ffmpeg to trim silence.

Thanks.


https://ffmpeg.org/ffmpeg-filters.html#silenceremove

Here is an example:

$ ffmpeg -hide_banner -i the_4_hour_work_week.wma  -af silenceremove=0:0:0:-1:5:-25dB the_4_hour_work_week.mp3

0:0:0:-1:5:-25dB means start_periods:start_duration:start_threshold:stop_periods:stop_duration:stop_threshold. So it will search for 5s of silence less than -25dB.

By the way, dB is case sensitive. Really. dB is the abbreviation for Decibel.