{"id":13529917,"url":"https://github.com/transitive-bullshit/ffmpeg-extract-audio","last_synced_at":"2025-06-29T13:02:53.145Z","repository":{"id":57234917,"uuid":"127616144","full_name":"transitive-bullshit/ffmpeg-extract-audio","owner":"transitive-bullshit","description":"Extracts an audio stream from a media file.","archived":false,"fork":false,"pushed_at":"2020-07-11T23:12:27.000Z","size":1630,"stargazers_count":18,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-22T20:44:43.424Z","etag":null,"topics":["ffmpeg","fluent-ffmpeg"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitive-bullshit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-01T09:39:52.000Z","updated_at":"2025-02-22T06:33:31.000Z","dependencies_parsed_at":"2022-08-23T15:31:21.036Z","dependency_job_id":null,"html_url":"https://github.com/transitive-bullshit/ffmpeg-extract-audio","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/transitive-bullshit/ffmpeg-extract-audio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-extract-audio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-extract-audio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-extract-audio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-extract-audio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitive-bullshit","download_url":"https://codeload.github.com/transitive-bullshit/ffmpeg-extract-audio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Fffmpeg-extract-audio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598139,"owners_count":23334667,"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":["ffmpeg","fluent-ffmpeg"],"created_at":"2024-08-01T07:00:40.740Z","updated_at":"2025-06-29T13:02:51.887Z","avatar_url":"https://github.com/transitive-bullshit.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# ffmpeg-extract-audio\n\n\u003e Extracts an audio stream from a media file using [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg).\n\n[![NPM](https://img.shields.io/npm/v/ffmpeg-extract-audio.svg)](https://www.npmjs.com/package/ffmpeg-extract-audio) [![Build Status](https://travis-ci.com/transitive-bullshit/ffmpeg-extract-audio.svg?branch=master)](https://travis-ci.com/transitive-bullshit/ffmpeg-extract-audio) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install --save ffmpeg-extract-audio\n# or\nyarn add ffmpeg-extract-audio\n```\n\n## Usage\n\n```js\nconst extractAudio = require('ffmpeg-extract-audio')\n\nawait extractAudio({\n  input: 'media/1.mp4',\n  output: 'test.mp3'\n})\n```\n\n## API\n\n### extractAudio(options)\n\nExtracts an audio stream from a media file. Returns a `Promise` for when the operation is complete.\n\n#### options\n\n##### input\n\nType: `String`\n\nPath or URL to a media file.\n\n##### output\n\nType: `String`\n\nPath to write the output file to. If `output` is not specified, the result will be a `ReadableStream`.\n\n##### format\n\nType: `String`\n\nAudio container format to use.\n\nNote: you may either specify `output` or `format`. If `format` is not specified, it will be inferred from the `output` file extension. If no `format` or `output` file is specified, the result will default to an `mp3` stream.\n\n##### channel\n\nType: `Number`\nDefault: `0`\n\nWhich audio channel to extract in the case of multiple audio channels.\n\n##### transform\n\nType: `Function`\nDefault: `noop`\n\nOptional function to make changes to the underlying [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg) command. You may, for instance, change the [audio bitrate](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#audiobitratebitrate-set-audio-bitrate) or add custom [audio filters](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg#audiofiltersfilter-add-custom-audio-filters).\n\nExample:\n```js\n// extract audio at 50% volume (result is an mp3 stream)\nconst mp3Stream = await extractAudio({\n  input: 'media/1.mp4',\n  format: 'mp3',\n  transform: (cmd) =\u003e {\n    cmd.audioFilters([\n      {\n        filter: 'volume',\n        options: '0.5'\n      }\n    ])\n  }\n})\n```\n\n##### log\n\nType: `Function`\nDefault: `noop`\n\nOptional function to log the underlying ffmpeg command. You may, for example, use `console.log`\n\n## Related\n\n- [fluent-ffmpeg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg)\n- [awesome-ffmpeg](https://github.com/transitive-bullshit/awesome-ffmpeg) - A curated list of awesome ffmpeg resources with a focus on JavaScript.\n\n## License\n\nMIT © [Travis Fischer](https://github.com/transitive-bullshit)\n\nSupport my OSS work by \u003ca href=\"https://twitter.com/transitive_bs\"\u003efollowing me on twitter \u003cimg src=\"https://storage.googleapis.com/saasify-assets/twitter-logo.svg\" alt=\"twitter\" height=\"24px\" align=\"center\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-extract-audio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-extract-audio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Fffmpeg-extract-audio/lists"}