• Stars
    star
    258
  • Rank 157,645 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

youtube synthesia video to midi

video2midi

youtube synthesia video to midi, just for fun )

ВоссозданиС midi с Π²ΠΈΠ΄Π΅ΠΎ Ρ€ΠΎΠ»ΠΈΠΊΠΎΠ² synthesia ΠΈ Π΅ΠΉ ΠΏΠΎΠ΄ΠΎΠ±Π½Ρ‹ΠΌ.. Alt text

Video example on YouTube, creating midi from hybrid synthesia video & real piano video2midi 0.4.5.2

Video example on YouTube, creating 2 channels midi, version video2midi 0.3.9.1

Video example on YouTube, creating 6 channels midi, version video2midi 0.3.9.1

Video example on YouTube, creating 2 channels midi, version video2midi 0.3.0

Manual "How to" Or "How to use video2midi after installing"

GH already added new discuss functionality so we can talk without opening an issue... if you have any questions or comments, you can open discuss or you can write to whatsapp / telegram , i'll try to answer / help ;)

EN:

dependency

  • python-opengl
  • python-opencv
  • python-pygame
  • python-midiutil

install dependency

Debian based Linux:

sudo apt install python-opencv python-pygame python-midiutil python-opengl

Arch Linux:

sudo pacman -S hdf5 python-opencv python-pygame python-opengl
sudo pip install midiutil

Or thanks to C0rn3j you can install video2midi just from AUR now using your favorite AUR helper:

yay -S video2midi-git

Windows + Anaconda2 (python 2.7)/Anaconda3 (python 3.7):

usage

Download the video with your favorite melody (I recommend 720p), launch the program, adjust the keys in it, press Q and after the completion of the work a midi file will be created.

GNU/Linux:
./v2m.py ./synthesia_video.mkv
Windows+Anaconda2 (python 2.7)/Anaconda3 (python 3.7):

in start menu search and open Anaconda command prompt:

cd path to v2m.py
python v2m.py synthesia_video.mkv

Control:

  • h - show/hide this help
  • q - begin to recreate midi
  • s - set start frame, (mods : shift, set processing start frame to the beginning)
  • e - set end frame, (mods : shift, set processing end frame to the ending), on some formats, it does not work correctly, it seems like an OpenCV bug
  • p - if the key is specified, it will forcibly divide the output into 2 channels regardless of the settings. Splitting will be carried out depending on the position of the key relative to the specified key. Used on video with one key color.
  • o - enable or disable the ability to recognize the overlap of keys with each other. In this case, at the moment of overlapping, the end of one note and the beginning of another will be created.
  • i - enable or disable ignore/lengthening of notes with minimal duration ( if enabled the notes whose duration will be less than that specified will be ignored. If disabled the notes whose duration will be less than that specified will be automatically equated to the minimum duration.)
  • r - enable or disable resize function
  • Mouse wheel - keys adjustment
  • Left mouse button - dragging the selected key / select color from the color map
  • CTRL + Left mouse button - update selected color in the color map
  • CTRL + 0 - disable selected color in the color map
  • Right mouse button - dragging all keys, if the key is selected, the transfer is carried out relative to it.
  • Arrows - keys adjustment (mods : shift)
  • PageUp/PageDown - scrolling video (mods : shift)
  • Home/End - go to the beginning or end of the video
  • F2/F3 - save / load settings.
  • [ / ] - change base octave
  • Escape - quit
  • Space - abort re-creation and save midi file to disk

how it works

Frame by frame we scan the virtual keyboard and write the keys to the midi file...

Alt text

Additional features

All settings are moved to an ini file which can be used as common for all directories if it is located in the home directory (~/.v2m.ini) or as a separate for local directory (./v2m.ini).

You can also customize the separation into channels depending on the color of the key. To do this, in the v2m.ini file, you need to modify the color matching to the midi channel of the track. By default, each color key will be recorded in its own channel, so if you want to combine the channels, simply specify the same numbers for different colors.

color_channel_accordance = 0,0, 1,1, 2,2, 3,3, 4,4, 5,5

Alt text

You can customize the channel mapping to a MIDI instrument. To do this, in the v2m.ini file, you need to modify the correspondence of the midi channel to the instrument. The default all channels is 0 midi instrument.

channel_prog_accordance = 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 

RU:

зависимости

  • python-opengl
  • python-opencv
  • python-pygame
  • python-midiutil

установка зависимостСй.

Debian based Linux:

sudo apt install python-opencv python-pygame python-midiutil python-opengl

Arch Linux:

sudo pacman -S hdf5 python-opencv python-pygame python-opengl
sudo pip install midiutil

Windows + Anaconda2 (python 2.7)/Anaconda3 (python 3.7):

использованиС

Π‘ΠΊΠ°Ρ‡ΠΈΠ²Π°Π΅ΠΌ Π²ΠΈΠ΄Π΅ΠΎ с ΠΏΠΎΠ½Ρ€Π°Π²ΠΈΠ²ΡˆΠ΅ΠΉΡΡ ΠΌΠ΅Π»ΠΎΠ΄ΠΈΠ΅ΠΉ ( Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡƒΡŽ 720p ) , запускаСм ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΡƒ, Π² Π½Π΅ΠΉ Ρ€Π΅Π³ΡƒΠ»ΠΈΡ€ΡƒΠ΅ΠΌ клавиши ΠΆΠΌΡ‘ΠΌ Q ΠΈ послС Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΡ Ρ€Π°Π±ΠΎΡ‚Ρ‹ Π±ΡƒΠ΄Π΅Ρ‚ создан midi Ρ„Π°ΠΉΠ».

GNU/Linux:
./v2m.py ./synthesia_video.mkv
Windows+Anaconda2 (python 2.7)/Anaconda3 (python 3.7):

in start menu search and open Anaconda command prompt:

cd path to v2m.py
python v2m.py synthesia_video.mkv

Π£ΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΠ΅:

  • h - ΠΏΠΎΠΊΠ°Π·Π°Ρ‚ΡŒ/ΡΠΏΡ€ΡΡ‚Π°Ρ‚ΡŒ ΠΏΠΎΠΌΠΎΡ‰ΡŒ
  • q - ΠΏΡ€ΠΈΡΡ‚ΡƒΠΏΠΈΡ‚ΡŒ ΠΊ воссозданию midi
  • s - Π£ΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ Π½Π°Ρ‡Π°Π»ΡŒΠ½Ρ‹ΠΉ ΠΊΠ°Π΄Ρ€ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ (ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€: shift, сброс Π½Π° Π½Π°Ρ‡Π°Π»ΡŒΠ½Ρ‹ΠΉ ΠΊΠ°Π΄Ρ€ Π²ΠΈΠ΄Π΅ΠΎ)
  • e - Π£ΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ ΠΊΠΎΠ½Π΅Ρ‡Π½Ρ‹ΠΉ ΠΊΠ°Π΄Ρ€ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ (ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€: shift, сброс Π½Π° ΠΊΠΎΠ½Π΅Ρ‡Π½Ρ‹ΠΉ ΠΊΠ°Π΄Ρ€ Π²ΠΈΠ΄Π΅ΠΎ), Π½Π° Π½Π΅ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Ρ„ΠΎΡ€ΠΌΠ°Ρ‚Π°Ρ…, Π½Π΅ Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚ ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½ΠΎ, ΠΏΠΎΡ…ΠΎΠΆΠ΅ Π½Π° Π±Π°Π³ OpenCV
  • p - Если клавиша ΡƒΠΊΠ°Π·Π°Π½Π°, ΠΏΡ€ΠΈΠ½ΡƒΠ΄ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ Ρ€Π°Π·Π΄Π΅Π»ΠΈΡ‚ Π²Ρ‹Π²ΠΎΠ΄ Π½Π° 2 ΠΊΠ°Π½Π°Π»Π° Π½Π΅ зависимо ΠΎΡ‚ настроСк. Π Π°Π·Π΄ΠΈΠ»Π΅Π½ΠΈΠ΅ Π±ΡƒΠ΄Π΅Ρ‚ ΠΏΡ€ΠΎΠ²Π΅Π΄Π΅Π½ΠΎ Π² зависимости ΠΎΡ‚ полоТСния клавиши ΠΎΡ‚Π½ΠΎΡΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ ΡƒΠΊΠ°Π·Π°Π½ΠΎΠΉ клавиши. Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ Π½Π° Π²ΠΈΠ΄Π΅ΠΎ с ΠΎΠ΄Π½ΠΈΠΌ Ρ†Π²Π΅Ρ‚ΠΎΠΌ клавиш.
  • o - Π’ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ/Π²Ρ‹ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎΡΡ‚ΡŒ Ρ€Π°ΡΠΏΠΎΠ·Π½Π°Π²Π°Ρ‚ΡŒ ΠΏΠ΅Ρ€Π΅ΠΊΡ€Ρ‹Ρ‚ΠΈΠ΅ клавиш Π΄Ρ€ΡƒΠ³ Π΄Ρ€ΡƒΠ³ΠΎΠΌ. Π’ Π΄Π°Π½Π½ΠΎΠΌ случаС Π² ΠΌΠΎΠΌΠ΅Π½Ρ‚ пСрСкрытия Π±ΡƒΠ΄Π΅Ρ‚ создано ΠΎΠΊΠΎΠ½Ρ‡Π°Π½ΠΈΠ΅ ΠΎΠ΄Π½ΠΎΠΉ Π½ΠΎΡ‚Ρ‹ ΠΈ Π½Π°Ρ‡Π°Π»ΠΎ Π΄Ρ€ΡƒΠ³ΠΎΠΉ.
  • i - Π’ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ/Π²Ρ‹ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ ΠΈΠ³Π½ΠΎΡ€ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅/ΡƒΠ΄Π»ΠΈΠ½Π΅Π½ΠΈΠ΅ Π½ΠΎΡ‚ мСньшС минимальной Π΄Π»ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ Π½ΠΎΡ‚Ρ‹ ( Если Π²ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΎ Π΄Π°Π½Π½Ρ‹Π΅ Π½ΠΎΡ‚Ρ‹ Π½Π΅ Π±ΡƒΠ΄ΡƒΡ‚ записаны Π² midi. Если Π²Ρ‹ΠΊΠ»ΡŽΡ‡Π΅Π½ΠΎ Π½ΠΎΡ‚Ρ‹ Π΄Π»ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΡŒ ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Ρ… Π±ΡƒΠ΄Π΅Ρ‚ мСньшС ΡƒΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ Π±ΡƒΠ΄ΡƒΡ‚ автоматичСски ΠΏΡ€ΠΈΡ€Π°Π²Π½Π΅Π½Ρ‹ минимальной Π΄Π»ΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ. )
  • r - Π’ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ/Π²Ρ‹ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ ΠΌΠ°ΡΡˆΡ‚Π°Π±ΠΈΡ€ΠΎΠ²Π°Π½ΠΈΡ
  • Mouse wheel - подстройка клавиш
  • ЛСвая ΠΊΠ½ΠΎΠΏΠΊΠ° ΠΌΡ‹ΡˆΠΈ - пСрСтаскиваниС Π²Ρ‹Π±Ρ€Π°Π½Π½ΠΎΠΉ клавиши / Π²Ρ‹Π±ΠΎΡ€ Ρ†Π²Π΅Ρ‚Π° ΠΈΠ· ΠΊΠ°Ρ€Ρ‚Ρ‹ Ρ†Π²Π΅Ρ‚ΠΎΠ².
  • CTRL + ЛСвая ΠΊΠ½ΠΎΠΏΠΊΠ° ΠΌΡ‹ΡˆΠΈ - ΠΎΠ±Π½ΠΎΠ²ΠΈΡ‚ΡŒ Π²Ρ‹Π±Ρ€Π°Π½Π½Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚ ΠΊ ΠΊΠ°Ρ€Ρ‚Π΅ Ρ†Π²Π΅Ρ‚ΠΎΠ².
  • ΠŸΡ€Π°Π²Π°Ρ ΠΊΠ½ΠΎΠΏΠΊΠ° ΠΌΡ‹ΡˆΠΈ - пСрСтаскиваниС всСх клавиш, Ссли клавиша Π²Ρ‹Π±Ρ€Π°Π½Π°, пСрСнос осущСствляСтся ΠΎΡ‚Π½ΠΎΡΠΈΡ‚Π΅Π»ΡŒΠ½ΠΎ Π½Π΅Ρ‘
  • CTRL + 0 - Π’Ρ‹ΠΊΠ»ΡŽΡ‡ΠΈΡ‚ΡŒ Π²Ρ‹Π±Ρ€Π°Π½Π½Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚.
  • Π‘Ρ‚Ρ€Π΅Π»ΠΊΠΈ - подстройка клавиш (ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€: shift)
  • PageUp/PageDown - ΠΏΡ€ΠΎΠΊΡ€ΡƒΡ‚ΠΊΠ° Π²ΠΈΠ΄Π΅ΠΎ (ΠΌΠΎΠ΄ΠΈΡ„ΠΈΠΊΠ°Ρ‚ΠΎΡ€: shift, шаг ΠΏΠΎ ΠΊΠ°Π΄Ρ€Ρƒ)
  • Home/End - ΠΏΠ΅Ρ€Π΅Ρ…ΠΎΠ΄ Π² Π½Π°Ρ‡Π°Π»ΠΎ ΠΈΠ»ΠΈ ΠΊΠΎΠ½Π΅Ρ† Π²ΠΈΠ΄Π΅ΠΎ
  • [ / ] - ΠΈΠ·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ Π±Π°Π·ΠΎΠ²ΡƒΡŽ ΠΎΠΊΡ‚Π°Π²Ρƒ
  • F2/F3 - Π·Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ / Π·Π°Π³Ρ€ΡƒΠ·ΠΈΡ‚ΡŒ настройки.
  • ESCAPE - Π²Ρ‹Ρ…ΠΎΠ΄ / quit
  • SPACE - ΠΏΡ€Π΅Ρ€Π²Π°Ρ‚ΡŒ воссозданиС ΠΈ Π·Π°ΠΏΠΈΡΠ°Ρ‚ΡŒ midi Ρ„Π°ΠΉΠ» Π½Π° диск / abort re-creation and save midi file to disk

ΠΊΠ°ΠΊ это Ρ€Π°Π±ΠΎΡ‚Π°Π΅Ρ‚

ΠšΠ°Π΄Ρ€ Π·Π° ΠΊΠ°Π΄Ρ€ΠΎΠΌ сканируСтся Π²ΠΈΠ΄Π΅ΠΎ ΠΏΠΎΡ‚ΠΎΠΊ отслСТивая измСнСния Π²ΠΈΡ€Ρ‚ΡƒΠ°Π»ΡŒΠ½ΠΎΠΉ ΠΊΠ»Π°Π²ΠΈΠ°Ρ‚ΡƒΡ€Ρ‹ послС всё Ρ‡Ρ‚ΠΎ зафиксировано Π΄Π°ΠΌΠΏΠΈΠΌ Π½Π° Π²ΠΈΠ½Ρ‚.

Alt text

Π”ΠΎΠΏΠΎΠ»Π½ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹Π΅ возмоТности

ВсС настройки вынСсСны Π² Ρ„Π°ΠΉΠ» ini Ρ„Π°ΠΉΠ» ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ ΠΌΠΎΠΆΠ΅Ρ‚ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒΡΡ ΠΊΠ°ΠΊ ΠΎΠ±Ρ‰ΠΈΠΉ для всСх ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³ΠΎΠ² Ссли находится Π² домашнСм ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π΅ ~/.v2m.ini Π»ΠΈΠ±ΠΎ ΠΎΡ‚Π΄Π΅Π»ΡŒΠ½Ρ‹ΠΉ Π»ΠΎΠΊΠ°Π»ΡŒΠ½Ρ‹ΠΉ для ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π° ./v2m.ini.

Π’Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ Π½Π°ΡΡ‚Ρ€ΠΎΠΈΡ‚ΡŒ Ρ€Π°Π·Π±ΠΈΠ΅Π½ΠΈΠ΅ Π½Π° ΠΊΠ°Π½Π°Π»Ρ‹ Π² зависимости ΠΎΡ‚ Ρ†Π²Π΅Ρ‚Π° клавиши. Для этого Π² Ρ„Π°ΠΉΠ»Π΅ v2m.ini Π½ΡƒΠΆΠ½ΠΎ ΠΏΠΎΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ соотвСтствиС Ρ†Π²Π΅Ρ‚Π° ΠΊΠ°Π½Π°Π»Ρƒ midi Ρ‚Ρ€Π΅ΠΊΠ°. По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ ΠΊΠ°ΠΆΠ΄Ρ‹ΠΉ Ρ†Π²Π΅Ρ‚ Π°ΠΊΡ‚ΠΈΠ²ΠΈΡ€ΡƒΡŽΡ‰ΠΈΠΉ ΠΊΠ»Π°Π²ΠΈΡˆΡƒ Π±ΡƒΠ΄Π΅Ρ‚ записан Π² собствСнный ΠΊΠ°Π½Π°Π», Ρ‚Π°ΠΊΠΈΠΌ ΠΎΠ±Ρ€Π°Π·ΠΎΠΌ Ссли Ρ…ΠΎΡ‚ΠΈΡ‚Π΅ ΠΎΠ±ΡŠΠ΅Π΄ΠΈΠ½ΠΈΡ‚ΡŒ ΠΊΠ°Π½Π°Π»Ρ‹ просто ΡƒΠΊΠ°ΠΆΠΈΡ‚Π΅ для Ρ€Π°Π·Π½Ρ‹Ρ… Ρ†Π²Π΅Ρ‚ΠΎΠ² ΠΎΠ΄ΠΈΠ½Π°ΠΊΠΎΠ²Ρ‹Π΅ Π½ΠΎΠΌΠ΅Ρ€Π°.

color_channel_accordance = 0,0, 1,1, 2,2, 3,3, 4,4, 5,5

Alt text

Π’Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ Π½Π°ΡΡ‚Ρ€ΠΎΠΈΡ‚ΡŒ соотнСсСниС ΠΊΠ°Π½Π°Π»Π° ΠΊ MIDI инструмСнту. Для этого Π² Ρ„Π°ΠΉΠ»Π΅ v2m.ini Π½ΡƒΠΆΠ½ΠΎ ΠΏΠΎΠΏΡ€Π°Π²ΠΈΡ‚ΡŒ соотвСтствиС ΠΊΠ°Π½Π°Π»Π° midi инструмСнту. По ΡƒΠΌΠΎΠ»Ρ‡Π°Π½ΠΈΡŽ ΠΊΠ°Π½Π°Π» Ρ€Π°Π²Π΅Π½ 0 midi инструмСнту

channel_prog_accordance = 0,0, 0,0, 0,0, 0,0, 0,0, 0,0