{"id":14985005,"url":"https://github.com/beenotung/silencecut-ffmpeg","last_synced_at":"2025-04-10T23:15:03.936Z","repository":{"id":256304455,"uuid":"854894980","full_name":"beenotung/silencecut-ffmpeg","owner":"beenotung","description":"Detect and remove silent sections from video using ffmpeg.","archived":false,"fork":false,"pushed_at":"2024-11-05T16:28:07.000Z","size":21,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T23:14:57.178Z","etag":null,"topics":["audio-processing","cli","ffmpeg","ffmpeg-filter","media-editing","silence-detect","silence-remove","typescript","video-processing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/silentremove-ffmpeg","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beenotung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-10T00:20:23.000Z","updated_at":"2025-01-19T05:53:26.000Z","dependencies_parsed_at":"2024-09-10T09:38:47.642Z","dependency_job_id":null,"html_url":"https://github.com/beenotung/silencecut-ffmpeg","commit_stats":null,"previous_names":["beenotung/silentremove-ffmpeg","beenotung/silencecut-ffmpeg"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fsilencecut-ffmpeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fsilencecut-ffmpeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fsilencecut-ffmpeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beenotung%2Fsilencecut-ffmpeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beenotung","download_url":"https://codeload.github.com/beenotung/silencecut-ffmpeg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248312134,"owners_count":21082638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-processing","cli","ffmpeg","ffmpeg-filter","media-editing","silence-detect","silence-remove","typescript","video-processing"],"created_at":"2024-09-24T14:10:05.258Z","updated_at":"2025-04-10T23:15:03.900Z","avatar_url":"https://github.com/beenotung.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# silencecut-ffmpeg\n\nAuto cut out silent sections from video using ffmpeg filter silencedetect and silenceremove.\n\n[![npm Package Version](https://img.shields.io/npm/v/silencecut-ffmpeg)](https://www.npmjs.com/package/silencecut-ffmpeg)\n\n## Features\n\n- Typescript support\n- Isomorphic package: works in Node.js and browsers\n\n## Installation (Optional)\n\nThis package can be invoked with npx without explicit installation.\n\n### Option 0: Download the standalone executable\n\nThis option is available for Windows, MacOS and Linux users _without nodejs runtime_.\n\nThe executable is available in the [release page](https://github.com/beenotung/silencecut-ffmpeg/releases).\n\nAfter downloading the executable, you can use it as a command line tool. You may add the directory of the executable to your `PATH` environment variable for convenience.\n\n### Option 1: Using `npx` without installation\n\nYou can run the tool directly from the npm registry without having to install it globally or locally:\n\n```bash\nnpx -y silencecut-ffmpeg [options]\n```\n\nThe `-y` flag skip confirmation to download the package if it is not already cached.\n\nThis is convenient for one-off usage as it doesn’t require you to install or manage the tool. However, npx will check for updates each time it is invoked, which can add some overhead.\n\n### Option 2: Install as a version-controlled dependency\n\nTo avoid the overhead of npx checking for updates on every run, you can install `silencecut-ffmpeg` as a project dependency. This also ensures that the version you install is locked and won’t apply breaking changes unless you explicitly update it.\n\nInstalling the package as a dependency also allows you to use the API programmatically from your Node.js or TypeScript code, enabling more advanced usage like integrating the tool into larger workflows.\n\nSteps:\n\n1. **Install the package** as a project dependency (this will add it to your `package.json`):\n\n   ```bash\n   npm install silencecut-ffmpeg\n   ```\n\n2. **Invoke the installed version** using `npx`:\n\n   ```bash\n   npx silencecut-ffmpeg [options]\n   ```\n\nYou can also install `silencecut-ffmpeg` with [pnpm](https://pnpm.io/), [yarn](https://yarnpkg.com/), or [slnpm](https://github.com/beenotung/slnpm)\n\n## Usage Example\n\nYou can use `silencecut-ffmpeg` from cli or from nodejs.\n\n### Cli Usage\n\n```bash\nsilencecut-ffmpeg [options] \u003coutput file\u003e\n```\n\n#### Cli Options\n\n- `-i, --input \u003cfile\u003e`: Input file path (required)\n- `-d, --duration-threshold \u003csec\u003e`: Duration threshold in seconds (default: 1)\n- `-n, --noise-level-threshold \u003cdB\u003e`: Noise level threshold in dB (default: -50)\n- `-v, --version`: Show the version number\n- `-h, --help`: Show this help message\n\n#### Cli Usage Examples\n\n1. **Using default duration (1 second) and noise level (-50 dB) thresholds**:\n\n   ```bash\n   silencecut-ffmpeg -i in.mp4 out.mp4\n   ```\n\n2. **Custom thresholds: 1.5 seconds of silence and -40 dB noise level**:\n\n   ```bash\n   silencecut-ffmpeg --input in.mp4 --duration-threshold 1.5 --noise-level-threshold -40 out.mp4\n   ```\n\n3. **Fast-paced cutting: detect silence shorter than 0.2 seconds and noise below -40 dB**:\n   ```bash\n   silencecut-ffmpeg out.mp4 -i in.mp4 -n -40 -d 0.2\n   ```\n\n### API Usage\n\n```typescript\nimport { silentDetectAndRemove } from 'silencecut-ffmpeg'\n\nsilentDetectAndRemove({\n  inFile: 'in.mp4',\n  outFile: 'out.mp4',\n  durationThreshold: 1.5, // seconds\n  noiseLevelThreshold: -40, // dB\n})\n  .then(() =\u003e {\n    console.log('Silent sections removed.')\n  })\n  .catch(err =\u003e {\n    console.error(err)\n  })\n```\n\n## Typescript Signature\n\n```typescript\nimport { ProgressArgs } from 'ffmpeg-progress'\n\nexport type Section = {\n  /** @description in seconds */\n  start: number\n  /** @description in seconds */\n  end: number\n}\n\n/** @description chain silentDetect() and silentRemove() */\nexport function silentDetectAndRemove(options: {\n  inFile: string\n  outFile: string\n  /** @description -50 dB */\n  noiseLevelThreshold?: number\n  /** @description default 1 second */\n  durationThreshold?: number\n  onSilentDetectDuration?: ProgressArgs['onDuration']\n  onSilentDetectProgress?: ProgressArgs['onProgress']\n  onSilentRemoveDuration?: ProgressArgs['onDuration']\n  onSilentRemoveProgress?: ProgressArgs['onProgress']\n}): Promise\u003c{\n  nonSilentSections: Section[]\n  silentSections: Section[]\n}\u003e\n\nexport function silentDetect(\n  options: {\n    file: string\n    /** @description -50 dB */\n    noiseLevelThreshold?: number\n    /** @description default 1000 ms */\n    durationThreshold?: number\n    onSilentSection?: (section: Section) =\u003e void\n    onNonSilentSection?: (section: Section) =\u003e void\n  } \u0026 ProgressArgs,\n): Promise\u003c{\n  silentSections: Section[]\n  nonSilentSections: Section[]\n}\u003e\n\nexport function silentRemove(\n  options: {\n    inFile: string\n    outFile: string\n    /** @description nonSilentSections returned by silentDetect() or determined by custom logics */\n    sections: Section[]\n  } \u0026 ProgressArgs,\n): Promise\u003cvoid\u003e\n```\n\n## License\n\nThis project is licensed with [BSD-2-Clause](./LICENSE)\n\nThis is free, libre, and open-source software. It comes down to four essential freedoms [[ref]](https://seirdy.one/2021/01/27/whatsapp-and-the-domestication-of-users.html#fnref:2):\n\n- The freedom to run the program as you wish, for any purpose\n- The freedom to study how the program works, and change it so it does your computing as you wish\n- The freedom to redistribute copies so you can help others\n- The freedom to distribute copies of your modified versions to others\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fsilencecut-ffmpeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeenotung%2Fsilencecut-ffmpeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeenotung%2Fsilencecut-ffmpeg/lists"}