GithubHelp home page GithubHelp logo

doytsujin / remsi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bambax/remsi

0.0 2.0 0.0 18.33 MB

Remove silence from video files with a 1-line ffmpeg command

License: MIT License

Python 100.00%

remsi's Introduction

Remsi

Remove silence from video files with a one-line ffmpeg command.

Why

Apparently it's not possible to automatically remove silent part from a video file in one go with ffmpeg. The silencedetect audio filter only detects silence, and the silenceremove filter is an audio filter that only works on audio and doesn't remove corresponding video parts.

How

What this does is take as input the output of silencedetect and simply writes the corresponding audio and video select filters for ffmpeg. Then the command produces a video file with the silent parts removed.

Install & Use

Requires ffmpeg, Python3. Usage is as follows:

ffmpeg -i YOURINPUTFILE -hide_banner -af silencedetect=n=-50dB:d=1 -f null - 2>&1 | python remsi.py > COMMANDFILENAME

silencedetect filter accepts a noise level in dB and a minimum duration in seconds.

YOURINPUTFILE is the name of your input file (video or audio file: 'noise_a.mp4' for example).

COMMANDFILENAME is the name of the file you want to write the ffmpeg command to. After the execution of the above command, it will contain an ffmpeg command such as (for example):

ffmpeg -i noise_a.mp4 -vf "select='between(t,0,2.00093)+between(t,4.00009,6.00256)+between(t,7.99961,9.99989)+between(t,12.0001,13.9998)',setpts=N/FRAME_RATE/TB" -af "aselect='between(t,0,2.00093)+between(t,4.00009,6.00256)+between(t,7.99961,9.99989)+between(t,12.0001,13.9998)',asetpts=N/SR/TB" outfile_noise_a.mp4

This is actually a succession of select filters. Once run, it will output (reencode) a video file with the silent parts removed.

remsi's People

Contributors

bambax avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.