{"by":"bambax","descendants":1,"id":31792108,"kids":[31792117],"score":38,"text":"There was recently a Show HN for a program that lets one remove silence from video files [0]. I was almost certain that ffmpeg could do this...<p>But after searching for it, it turned out I was wrong: ffmpeg can&#x27;t do this out of the box, and also can&#x27;t read input from an EDL file [1].<p>So I set out to write a solution, as simple as possible: produce a list of select filters that are applied to video and audio, and retain only the non-silent parts.<p>The &#x27;silencedetect&#x27; audio filter detects silences, and produces timestamps for when silences start and end. So one can pipe the output of that to a Python script, that builds an ffmpeg command with the appropriate select filters.<p>The resulting ffmpeg command can be run to re-encode the video without the silent parts.<p>Hope this helps.<p>- - -<p>Notes:<p>1&#x2F; I did find something somewhat similar to what I ended up doing [2], but it&#x27;s complicated, and does the video encoding inside of Python. Granted, moviepy uses ffmpeg under the hood, but it&#x27;s still better if ffmpeg does all the encoding directly.<p>2&#x2F; This solution doesn&#x27;t produce a myriad of intermediary files that it would recombine afterwards; there is just one encoding of the output video file. &#x27;silencedetect&#x27; is very fast, so all in all running this should be pretty fast.<p>[0] <a href=\"https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31767830\" rel=\"nofollow\">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31767830</a><p>[1] <a href=\"https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Edit_decision_list\" rel=\"nofollow\">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Edit_decision_list</a><p>[2] <a href=\"https:&#x2F;&#x2F;donaldfeury.xyz&#x2F;remove-the-silent-parts-of-a-video-using-ffmpeg-and-python&#x2F;\" rel=\"nofollow\">https:&#x2F;&#x2F;donaldfeury.xyz&#x2F;remove-the-silent-parts-of-a-video-u...</a>","time":1655574671,"title":"Show HN: Remove Silence from Videos with Ffmpeg","type":"story","url":"https://github.com/bambax/Remsi"}