This package has been deprecated

Author message:

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.

mp3-split

4.1.0 • Public • Published

mp3-split

Split audio (and video) files

Install

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

npm install [-g] mp3-split

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

npm install [-g] ffmpeg-binaries

CLI

mp3-split comes with a built in CLI tool. Type mp3-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 format should be in the following format. For more info, checkout ffmpeg's duration syntax page.

[([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] emune - Gretchen
[07:52] 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] Bassti - To All The Ladys In The Place
[15:37] wish you still felt this way [ sophie meiers x 90sFlav ]
[18:04] quickly, quickly - getsomerest/sleepwell
[23:36] charlie toØ human - that "just got home from work" type of beat.
[25:37] jinsang - affection
[27:32] jhfly - girl

Library

You can also use mp3-split as a library. Ex:

let mp3Split = require('mp3-split');
let options = {input: 'myaudio.mp3', audios: ['[01:30] My audio']};
let split = mp3Split(options);
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
  }
});

mp3-split emits the following events.

// emitted before splitting a file section
mp3Split.on('beforeSplit', (info) => console.log(info));
// emitted after splitting file
mp3Split.on('afterSplit', (parsedInfo) => console.log(parsedInfo));
// emitted when a video is found within the given url
mp3Split.on('url', (videoInfo) => console.log(videoInfo));
// emitted when the "sections" option is parsed and BEFORE splitting the file
mp3Split.on('data', (data) => console.log(data));

License

Licensed under the incredibly permissive MIT license

Dependents (0)

Package Sidebar

Install

npm i mp3-split

Weekly Downloads

2

Version

4.1.0

License

MIT

Unpacked Size

16.1 kB

Total Files

7

Last publish

Collaborators

  • nevermnd