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

7

1

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.

user49390

Posted 2010-09-15T11:06:55.037

Reputation: 109

Answers

4

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.

Chloe

Posted 2010-09-15T11:06:55.037

Reputation: 4 502

This will reencode the file? – Vitaly Zdanevich – 2018-11-11T15:20:21.287