When my teacher gives a presentation in our class, it is recorded.

The end result is that you have an mp4 file with the slides and the voice of my teacher.

In most cases the first ten-15 minutes is just silence and the welcome slide.
My question is how do I remove or delete the silence from this mp4 using command line tools such as sox or ffmpeg, or in any programmatic way.

So that the long periods of silence are detected and then automatically removed and the new mp4 file contains only parts where the teacher is speaking.

For wav files I know one can use sox to remove silence like:
sox this.mp4 out6.mp4 silence -l 1 0.1 1% -1 2.0 1%

Thank you.

1 Answer 1


If the goal is to remove a portion of the beginning of the mp4 file, you can do that using the -ss option in ffmpeg

ffmpeg -ss 00:15:00.0 -i class.mp4 -acodec copy -vcodec copy clipped_class.mp4

...will trim approximately 15 minutes from the mp4 file.

  • 1
    thank you for the answer. this is works very well when I know where the silence ends. Is there anyway to generalize this answer so as to autodetect a long period of silence and then cut it out. Ex: say I have 20 files but some have silence ending at 10 minutes some have silence ending at 15 minutes and so on at different time durations? (updating question to reflect the same)
    – kRazzy R
    Oct 24, 2017 at 0:55
  • If possible could you please update answer to show : ` how to trim last x minutes of the file; and how to trim a portion of the file between time t1 and t2?
    – kRazzy R
    Jan 10, 2018 at 19:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .