{"id":13583014,"url":"https://github.com/sugiruu/media-split","last_synced_at":"2025-04-10T23:25:03.974Z","repository":{"id":52484665,"uuid":"76654408","full_name":"sugiruu/media-split","owner":"sugiruu","description":"Split media files","archived":false,"fork":false,"pushed_at":"2022-01-10T18:09:18.000Z","size":2562,"stargazers_count":22,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T23:02:10.541Z","etag":null,"topics":["cli","ffmpeg","media","mp3","nodejs","split","video"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sugiruu.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}},"created_at":"2016-12-16T13:05:13.000Z","updated_at":"2024-01-11T07:54:13.000Z","dependencies_parsed_at":"2022-09-18T19:42:18.719Z","dependency_job_id":null,"html_url":"https://github.com/sugiruu/media-split","commit_stats":null,"previous_names":["skiptirengu/mp3-split","sugiruu/media-split","skiptirengu/media-split"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sugiruu%2Fmedia-split","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sugiruu%2Fmedia-split/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sugiruu%2Fmedia-split/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sugiruu%2Fmedia-split/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sugiruu","download_url":"https://codeload.github.com/sugiruu/media-split/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248190500,"owners_count":21062282,"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":["cli","ffmpeg","media","mp3","nodejs","split","video"],"created_at":"2024-08-01T15:03:11.553Z","updated_at":"2025-04-10T23:25:03.953Z","avatar_url":"https://github.com/sugiruu.png","language":"JavaScript","readme":"# Media-split\n\n[![Actions Status](https://github.com/skiptirengu/media-split/workflows/Node.js%20CI/badge.svg)](https://github.com/skiptirengu/media-split/actions)\n\nSplit audio (and video) files\n\n## Install\n\nMake sure you have [ffmpeg](https://ffmpeg.org/) installed and added to your path then run:\n\n```bash\nnpm install [-g] media-split\n```\n\nIf you don't have ffmpeg installed, you can install [this](https://www.npmjs.com/package/ffmpeg-static) or [this](https://www.npmjs.com/package/@ffmpeg-installer/ffmpeg) package which \ncomes with a bundled ffmpeg, and media-split will automatically detect and use it.\n\n```bash\nnpm install [-g] ffmpeg-static\n```\nor\n```bash\nnpm install [-g] @ffmpeg-installer/ffmpeg\n```\n\n## CLI\n\nmedia-split comes with a built in CLI tool. Type `media-split -h` to list all options and see an usage example.\nFor input you can use either a YouTube link or a local file.\n\nThe template file should be in the following format.\nFor more info, checkout [ffmpeg's duration syntax](https://ffmpeg.org/ffmpeg-utils.html#Time-duration) page.\n```\n[([hh:]mm:ss[.ms...]) [ - ([hh:]mm:ss[.ms...])]] My Music Name\n```\n\nA template file usually looks like this:\n```\n[00:00] eli filosov [ p h i l o ] - oneofone_rwrk\n[01:30] Swishers [SwuM x bsd.u]\n[03:28] sweetbn _ i held you so close i forgot the world\n[05:52 - 07:49] emune - Gretchen\n[07:52 - 09:50] jhfly - sheets\n[10:00] arbour - elusive\n[11:30] tomppabeats - will you stay here with me\n[12:40] tomppabeats - lonely but not when you hold me\n[13:31 - 15:30] Bassti - To All The Ladys In The Place\n[15:37] wish you still felt this way [ sophie meiers x 90sFlav ]\n```\n\n## Known issues\n\nSometimes, when downloading videos from YouTube, media-split can fail with the error message \"Too many redirects\".\nThis is caused by a third party library and is already being tracked [here](https://github.com/fent/node-ytdl-core/issues/212).\n\n## Library\n\nYou can also use media-split as a library.\n\n```js\nlet MediaSplit = require('media-split');\nlet split = new MediaSplit({ input: 'myaudio.mp3', sections: ['[01:30] My audio'] });\nsplit.parse().then((sections) =\u003e {\n  for (let section of sections) {\n    console.log(section.name);      // filename\n    console.log(section.start);     // section start\n    console.log(section.end);       // section end\n    console.log(section.trackName); // track name\n  }\n});\n```\n\n### new MediaSplit(options)\n**Returns**: MediaSplit  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| options | \u003ccode\u003eobject\u003c/code\u003e |  |\n| options.downloadCover | \u003ccode\u003eboolean\u003c/code\u003e | Whether to download the cover from the YouTube video |\n| options.input | \u003ccode\u003estring\u003c/code\u003e | The input file. Can be either a file path or a YouTube url |\n| options.concurrency | \u003ccode\u003enumber\u003c/code\u003e | Number of parallel workers MediaSplit will spawn at once |\n| options.sections | \u003ccode\u003eArray.\u0026lt;string\u0026gt;\u003c/code\u003e | Sections to extract from the input source. Supported formats are `[01:30 - 03:50] File` or `[01:30] File` |\n| options.output | \u003ccode\u003estring\u003c/code\u003e | Output path |\n| options.format | \u003ccode\u003estring\u003c/code\u003e | Output format (mp3, m4a, flac, etc) |\n| options.audioonly | \u003ccode\u003eboolean\u003c/code\u003e | Force download only audio files when using a url as input |\n| options.quality | \u003ccode\u003estring\u003c/code\u003e | The download quality when downloading from YouTube (highest/lowest/highestaudio/lowestaudio/highestvideo/lowestvideo) |\n| options.inputParams | \u003ccode\u003eArray.\u0026lt;string\u0026gt;\u003c/code\u003e | Additional input parameters for FFMpeg\n| options.outputParams | \u003ccode\u003eArray.\u0026lt;string\u0026gt;\u003c/code\u003e | Additional output parameters for FFMpeg\n\n### MediaSplit.parse() ⇒ \u003ccode\u003ePromise.\u0026lt;Array.\u0026lt;object\u0026gt;\u0026gt;\u003c/code\u003e\nSplit the media\n\n### \"url\" (input, info, cached)\nURL event. This event is emitted only once.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| input | \u003ccode\u003estring\u003c/code\u003e | The input file |\n| info | \u003ccode\u003eobject\u003c/code\u003e | The video info |\n| cached | \u003ccode\u003eboolean\u003c/code\u003e | Whether the file was cached or not |\n\n### \"data\" (sections)\nData event. This event is emitted only once.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| sections | \u003ccode\u003eArray.\u0026lt;object\u0026gt;\u003c/code\u003e | Array with the parsed sections |\n\n### \"beforeSplit\" (info, index)\nEmitted before a section is split.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| info | \u003ccode\u003eobject\u003c/code\u003e | Section info |\n| index | \u003ccode\u003enumber\u003c/code\u003e | Index |\n\n### \"afterSplit\" (info, index)\nEmitted after a section is split.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| info | \u003ccode\u003eobject\u003c/code\u003e | Section info |\n| index | \u003ccode\u003enumber\u003c/code\u003e | Section index |\n\n### \"downloadProgress\" (chunk, downloaded, total)\nDownload progress.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| chunk | \u003ccode\u003enumber\u003c/code\u003e | Chunk length in bytes |\n| downloaded | \u003ccode\u003enumber\u003c/code\u003e | Total downloaded in bytes |\n| total | \u003ccode\u003enumber\u003c/code\u003e | Total download length in bytes |\n\n### \"downloadLength\" (length)\nTotal download length. This event is emitted only once.\n\n| Param | Type | Description |\n| --- | --- | --- |\n| length | \u003ccode\u003enumber\u003c/code\u003e | Length in bytes |\n\n## License\n\nLicensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence)\n[MIT license](http://creativecommons.org/licenses/MIT/)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsugiruu%2Fmedia-split","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsugiruu%2Fmedia-split","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsugiruu%2Fmedia-split/lists"}