A Node.js command-line tool for automatically generating YTPMV (YouTube Poop Music Videos) or MAD videos. It takes a short source video and a target MIDI file, and automatically pitch-shifts and sequences the source video to match the notes of a specified MIDI track.
- Node.js installed on your system.
- FFmpeg installed and accessible in your system's PATH. This tool heavily relies on
fluent-ffmpegto process video and audio.
Clone the repository and install the dependencies:
git clone https://github.com/yourusername/ytpmv-maker.git
cd ytpmv-maker
npm installBasic usage:
node index.js --video input.mp4 --midi input.mid --channel 0 --basePitch 60 --output output.mp4The CLI supports the following configuration options:
| Option | Alias | Description | Default |
|---|---|---|---|
--video |
-v |
Path to the source video file to be pitched. | ./input.mp4 |
--midi |
-m |
Path to the target MIDI file. | ./input.mid |
--channel |
-c |
MIDI track/channel index to use for the sequence. | 0 |
--basePitch |
-b |
MIDI Pitch value describing the un-shifted source video note (e.g., 60 is C4). |
60 |
--output |
-o |
Output file name. | output.mp4 |
--info |
-i |
Print MIDI file information (tracks and note counts) and exit without rendering. | |
--audioOnly |
-a |
Only generate the audio track. Useful for faster rendering and debugging. | false |
--tenSeconds |
-t |
Only generate the first 10 seconds of output. Useful for testing before doing a full render. | false |
--debugNotes |
-d |
Output the parsed MIDI notes to the specified JSON file and exit. | |
--help |
-h |
Show help information. |
- The tool reads the target MIDI file (
--midi) using@tonejs/midi. - It parses the specified track (
--channel) into a sequence of notes with timings and duration. - It takes the source video (
--video) and determines how much it needs to be pitch-shifted. The base pitch of the source video is defined by--basePitch. - It uses FFmpeg via
fluent-ffmpegto generate clips at the correct pitch, scale the duration of the clips to match the MIDI notes, and eventually concatenates or mixes them to produce the finaloutput.mp4.
-
Find out the MIDI tracks: Run
node index.js -m your_song.mid -ito list all available tracks in your MIDI file. Find the track index (e.g.,2) that contains the main melody.You can use an online tool like https://www.openmusic.ai/midi-editor to view and edit a MIDI file.
-
Find out the base note of your source video: Determine the pitch of the subject in your source video. For example, if the subject is singing an 'A4', the
--basePitchwould be69. Use the same online tools as above to find the base note. -
Test the output: Run a quick 10-second test to see if it sounds correct:
node index.js -v source.mp4 -m your_song.mid -c 2 -b 69 -t -
Render the final video:
node index.js -v source.mp4 -m your_song.mid -c 2 -b 69 -o final.mp4
- @tonejs/midi - For parsing MIDI files.
- fluent-ffmpeg - A fluent API to FFmpeg.
- yargs - For command-line argument parsing.