3

Some earlier threads said that the silenceremove filter doesn't support trimming silence from the end? is this still the case?

My audio is lossless so I don't need to streamcopy or anything fancy like that.

Also how do I set it up to cut "silence" less than 96dB?

2 Answers 2

4

Here is a python script that does exactly that:

  • it reads all m4a files from a folder called input
  • removes silence from beginning and end
  • outputs the files to output

Source:

import os
temp1 = "temp1.m4a"
temp2 = "temp2.m4a"
temp3 = "temp3.m4a"
all_files = [x for x in os.listdir("input/")]
for file in all_files:
  if file.endswith(".m4a"):
    print os.popen("ffmpeg -i long/" + file + " -af silenceremove=1:0:-96dB " + temp1).read()
    print os.popen("ffmpeg -i " + temp1 + " -af areverse " + temp2).read()
    print os.popen("ffmpeg -i " + temp2 + " -af silenceremove=1:0:-96dB " + temp3).read()
    print os.popen("ffmpeg -i " + temp3 + " -af areverse output/" + file).read()
    os.remove(temp1)
    os.remove(temp2)
    os.remove(temp3)
3

With version 4.1.3 still can't trim from end.

Workaround:

ffmpeg -i IN.WAV -af silenceremove=start_periods=1:start_silence=0.1:start_threshold=-96dB,areverse,silenceremove=start_periods=1:start_silence=0.1:start_threshold=-96dB,areverse OUT.WAV
1
  • With version 4.4.1, this still doesn't work - silenceremove with positive stop_periods value appears to remove arbitrary audio sections from the middle of audio.
    – Guss
    Feb 6 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.