title: How to detect the silence at the end of an audio file?
body: <p>I am trying to detect silence at the end of an audio file.<br>
  I have made some progress with <strong>ffmpeg</strong> library. Here I used <strong>silencedetect</strong> to list all the silences in an audio file.</p>
  
  <pre><code>ffmpeg -i audio.wav -af silencedetect=n=-50dB:d=0.5 -f null - 2&gt; /home/aliakber/log.txt
  </code></pre>
  
  <p>Here is the output of the command:  </p>
  
  <p><strong>--With silence at the front and end of the audio file--</strong></p>
  
  <pre><code>[silencedetect @ 0x1043060] silence_start: 0.484979
  [silencedetect @ 0x1043060] silence_end: 1.36898 | silence_duration: 0.884
  [silencedetect @ 0x1043060] silence_start: 2.57298
  [silencedetect @ 0x1043060] silence_end: 3.48098 | silence_duration: 0.908
  [silencedetect @ 0x1043060] silence_start: 4.75698
  size=N/A time=00:00:05.56 bitrate=N/A
  </code></pre>
  
  <p><strong>--Without silence at the front and end of the audio file--</strong></p>
  
  <pre><code>[silencedetect @ 0x106fd60] silence_start: 0.353333
  [silencedetect @ 0x106fd60] silence_end: 1.25867 | silence_duration: 0.905333
  [silencedetect @ 0x106fd60] silence_start: 2.46533
  [silencedetect @ 0x106fd60] silence_end: 3.37067 | silence_duration: 0.905333
  size=N/A time=00:00:04.61 bitrate=N/A
  </code></pre>
  
  <p>But I want something more flexible so that I can manipulate the output and do further task depending on the result.<br>
  I want to get the output something like <strong>true</strong> or <strong>false</strong>. If there is a certain period of silence exists at the end of the audio file it will return <strong>true</strong> and <strong>false</strong> otherwise.</p>
  
  <p>Can someone suggest me an easy way to achieve this?</p>