0
votes

I have a .wav audio file and I need to extract silence/pause duration in this file. I'm using ffmpeg with silence detect filter but I'm unable to understand why its not giving silence duration with this file while it gives result with other files. Can anyone help me to understand the out given below that why its not showing detected silences.

Input Command:

ffmpeg -i "input.wav" -af silencedetect=noise=-30dB:d=0.5 -f null -

OutPut

ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --    enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable- 
libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-
libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --
enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --
enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid -- 
 enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --    enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt

libavutil      56. 31.100 / 56. 31.100
libavcodec     58. 54.100 / 58. 54.100
libavformat    58. 29.100 / 58. 29.100
libavdevice    58.  8.100 / 58.  8.100
libavfilter     7. 57.100 /  7. 57.100
libswscale      5.  5.100 /  5.  5.100
libswresample   3.  5.100 /  3.  5.100
libpostproc    55.  5.100 / 55.  5.100

Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, wav, from 'D:\Research\PhD\Carolina\AD\wav\media.io_Wakeman_Rhyne_001_01.wav':
Duration: 00:17:38.04, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
1
Without a sample input file the only suggestion we can give is to adjust the noise and d values.llogan
changing the duration have no effect on output. But yes when I changed the noise from -30db to -0.01, its giving me the silence duration outputAizayousaf
What does that mean? The sample file have much noise?Aizayousaf

1 Answers

2
votes

Adjust the noise and/or d values. From the silencedetect documentation:

The filter accepts the following options:

  • noise, n - Set noise tolerance. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default is -60dB, or 0.001.

  • duration, d - Set silence duration until notification (default is 2 seconds).

"Silence" is often not 100% silent. There could be background noise. In that case you'll need to adjust the noise value until it detects what you want as silence. For example, if you use noise=-15dB, then anything equal to or quieter than -15 dB will be detected as silence.

enter image description here

This screenshot from Audacity shows a "silent" area that is highlighted. It sounds silent compared to the rest of the audio, but if you were to listen carefully you would hear a ventilation fan and other background noise. The VU meter in Audacity shows that it is actually -34 dB at its loudest, so you would have to use at least noise=-34dB.

Additionally you may need to adjust d to tell it the minimum length the silent segment needs to be before it is detected as silence.