ms

mp3-split

Split media files

Showing:

Popularity

Downloads/wk

0

GitHub Stars

14

Maintenance

Last Commit

7mos ago

Contributors

7

Package

Dependencies

5

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Deprecated!
mp3-split was deprecated in favor of the new media-split package. The new media-split has a lot of improvements and new features so please consider updating to that instead (npm i media-split). For docs visit https://github.com/skiptirengu/media-split.

Readme

Media-split

Actions Status

Split audio (and video) files

Install

Make sure you have ffmpeg installed and added to your path then run:

npm install [-g] media-split

If you don't have ffmpeg installed, you can install this or this package which comes with a bundled ffmpeg, and media-split will automatically detect and use it.

npm install [-g] ffmpeg-static

or

npm install [-g] @ffmpeg-installer/ffmpeg

CLI

media-split comes with a built in CLI tool. Type media-split -h to list all options and see an usage example. For input you can use either a YouTube link or a local file.

The template file should be in the following format. For more info, checkout ffmpeg's duration syntax page.

[([hh:]mm:ss[.ms...]) [ - ([hh:]mm:ss[.ms...])]] My Music Name

A template file usually looks like this:

[00:00] eli filosov [ p h i l o ] - oneofone_rwrk
[01:30] Swishers [SwuM x bsd.u]
[03:28] sweetbn _ i held you so close i forgot the world
[05:52 - 07:49] emune - Gretchen
[07:52 - 09:50] jhfly - sheets
[10:00] arbour - elusive
[11:30] tomppabeats - will you stay here with me
[12:40] tomppabeats - lonely but not when you hold me
[13:31 - 15:30] Bassti - To All The Ladys In The Place
[15:37] wish you still felt this way [ sophie meiers x 90sFlav ]

Known issues

Sometimes, when downloading videos from YouTube, media-split can fail with the error message "Too many redirects". This is caused by a third party library and is already being tracked here.

Library

You can also use media-split as a library.

let MediaSplit = require('media-split');
let split = new MediaSplit({ input: 'myaudio.mp3', sections: ['[01:30] My audio'] });
split.parse().then((sections) => {
  for (let section of sections) {
    console.log(section.name);      // filename
    console.log(section.start);     // section start
    console.log(section.end);       // section end
    console.log(section.trackName); // track name
  }
});

new MediaSplit(options)

Returns: MediaSplit

ParamTypeDescription
optionsobject
options.downloadCoverbooleanWhether to download the cover from the YouTube video
options.inputstringThe input file. Can be either a file path or a YouTube url
options.concurrencynumberNumber of parallel workers MediaSplit will spawn at once
options.sectionsArray.<string>Sections to extract from the input source. Supported formats are [01:30 - 03:50] File or [01:30] File
options.outputstringOutput path
options.formatstringOutput format (mp3, m4a, flac, etc)
options.audioonlybooleanForce download only audio files when using a url as input
options.qualitystringThe download quality when downloading from YouTube (highest/lowest/highestaudio/lowestaudio/highestvideo/lowestvideo)

MediaSplit.parse() ⇒ Promise.<Array.<object>>

Split the media

"url" (input, info, cached)

URL event. This event is emitted only once.

ParamTypeDescription
inputstringThe input file
infoobjectThe video info
cachedbooleanWhether the file was cached or not

"data" (sections)

Data event. This event is emitted only once.

ParamTypeDescription
sectionsArray.<object>Array with the parsed sections

"beforeSplit" (info, index)

Emitted before a section is split.

ParamTypeDescription
infoobjectSection info
indexnumberIndex

"afterSplit" (info, index)

Emitted after a section is split.

ParamTypeDescription
infoobjectSection info
indexnumberSection index

"downloadProgress" (chunk, downloaded, total)

Download progress.

ParamTypeDescription
chunknumberChunk length in bytes
downloadednumberTotal downloaded in bytes
totalnumberTotal download length in bytes

"downloadLength" (length)

Total download length. This event is emitted only once.

ParamTypeDescription
lengthnumberLength in bytes

License

Licensed under the incredibly permissive MIT license

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial