0

As I read silenceremove will reencode file.

Usually I do it manually creating file like:

file 'file.mp3'
inpoint 0
outpoint 01:55:00.0

file 'file.mp3'
inpoint 02:03:50.0

and executing this command:

ffmpeg -f concat -safe 0 -i list.txt -c copy file.mp3

Maybe I can use silencedetect for creating the same file...

8
  • 1
    Because MP3 is a compressed format, the silences can be identified only by decompressing, necessitating recompression after removal. To remove silences without further degradation you would need to edit the original file before MP3 encoding; if this is unavailable, the best you can do is to decompress, remove the silences and save with a lossless encoder, but you will then have much poorer compression in comparison with MP3.
    – AFH
    Commented Nov 11, 2018 at 15:47
  • But with ffmpeg we already can cut parts of mp3 without reencoding specifying regions manually. Commented Nov 11, 2018 at 17:16
  • I was not expecting that, but after looking at the MP3 specification it seems that each data block may be independently compressed. You should be able to create an edit list from silencedetect, but it is probably worth checking if you can add -c copy to the silenceremove command string. Unfortunately I don't have these options in my copy of ffmpeg (3.4.4), so I can't test if it works.
    – AFH
    Commented Nov 11, 2018 at 18:51
  • @AFH From another answer: You cannot use -acodec copy to keep the original quality. Commented Nov 11, 2018 at 20:23
  • 1
    @nullptr why not, because now we already can cut a part of a file without reencoding. Commented Jul 17, 2019 at 7:15

1 Answer 1

0

This is answered in the Stack Overflow post using FFMPEG with silencedetect to remove audio silence.

The first remark is that silencedetect only detects the silence, not remove it. You should use instead the silenceremove filter.

To detect whether your version of ffmpeg has this filter run:

ffmpeg -hide_banner -filters | grep silenceremove

The output should look like:

silenceremove A->A Remove silence

The command to remove silent parts may look like:

ffmpeg -i input.mp3 -af silenceremove=1:0:-50dB output.mp3

Where the silenceremove parameter is explained as removing:

  • at the beginning (indicated by the first argument 1)
  • with minimum length zero (indicated by the second argument 0)
  • silence is classified as anything under -50 decibels (indicated by -50dB)

Reference: FFMPEG silence remove filter.

For finding the right value for silence, normalize first the input audio volume to 0dB, described in this answer.

6
  • Comment under your first link: Please note, that -af silenceremove **will re-encode** your audio files. Commented Nov 11, 2018 at 20:18
  • This would actually be required, since the encoding scheme may need to re-encode the audio immediately before or after the cut-out silent part.
    – harrymc
    Commented Nov 11, 2018 at 20:24
  • But using ffmpeg we can manually cut parts of the mp3 without reencoding. Commented Nov 11, 2018 at 20:26
  • I have no knowledge about how this filter was programmed.
    – harrymc
    Commented Nov 11, 2018 at 20:29
  • 1
    @VitalyZdanevich Filtering requires re-encoding. The input is decoded, fed to the filter, then encoded to your output format. So you can't stream copy when filtering. "Manually cut parts of the mp3" with stream copy omits decoding/encoding and only re-muxes.
    – llogan
    Commented Nov 11, 2018 at 21:38

You must log in to answer this question.

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