Pack of scripts providing customizable YouTube Music Videos Generation.
But applicable to Shorts too.
It generates:
- Video from image and audio file, that also can contain the embedded front cover art. 🎦
- Thumbnail with a centered image that background color is based on the subjectively selected image color clusters. 🖼️
Programs:
Modules:
sty >= 1.0.4- Colored terminal output 🎨colour >= 0.1.5- Colors handling 🎨distro >= 1.7* - Unix directory opening handler 📂mutagen >= 1.45.1- Audio state checker & video length handler ⏳Pillow >= 9- Image processor 🖼️CV2- Image processor 🖼️numpy- Colors histogram generation ⚙️scikit-learn- Colors histogram calculations ⚙️
Packages (bold links are Windows static executable binaries):
FFmpeg >= 4.2- Video processing 🎦- 64-bit reccomended! (possible memory allocation failures)
JPEGOptim >= 1.4.7- Thumbnail optimization 📉Python3-PIP*Python3-TK*
* - Required on Linux
When on Linux, install required packages by using this one-liner:
sudo apt-get install git python3-apt python3-pip python3-tk ffmpeg jpegoptim- Clone the repository and move to its directory.
git clone https://github.com/kubinka0505/YTMVG cd YTMVG - Install required modules by inputting
pip install -r requirements.txt - Modify the parameters in the
Config.jsonfile. (or use command line arguments below) - Type
YTMVG.py -hfor more info. ℹ️
Process audio (-a) and image (-i)
YTMVG.py -a "~/Music/Song.mp3" -i "~/Pictures/Image.png"As above, but set the video resolution (-r) to 720p and audio bitrate (-ab) to 128 kb/s
YTMVG.py -i "../Cover.jpg" -a "%UserProfile%\Downloads\Sound.ogg" -r 720p -ab 128kProcess audio with embedded cover, (no -i) encode lossless audio (-ab 257) and encode as WebM (-webm)
YTMVG.py -a "~/Music/Discography/Artist/Album/Artist - Title.flac" -ab 257 -webmAs above, but process audio URL, change color (-c) to Dry and process silently (-v -1)
YTMVG.py -a "https://website.com/Artist ft. Guest - Title (Remix).flac" -ab 257 -webm -c 1 -v -1Program comes in with bundled presets located as text files in the Data/Presets directory. You may edit them or add your own.
Note
To launch the preset, use the -p flag, where argument is the preset file name without last extension.
Example: YTMVG.py -a ... -p MyPresetFile (Data/Presets/MyPresetFile.txt)
By running the !_GUI_Add.pyw file, multiple values are injected into the HKEY_CURRENT_USER registry hive.
It enables quick, clear and batch usage directly from the Explorer.exe level, as shown below.
You can configure the !_GUI_Batch_Processing.py file for your needs.
Important
This program is a free and open-source tool including implementation of the algorithm responsible for creating YouTube music videos and its thumbnails.
It uses other free open-source tools and resources available in the public domain to guarantee satisfactory results, albeit the author of this particular software is not affiliated with YouTube or its associates, nor can be responsible — as stated in the license file — for guaranteeing its correct behavior and the consequences resulting from its improper use.
All versions of this project have been tested on:
| OS | Distribution | OS Version | Python Version | System Architecture (bits) |
|---|---|---|---|---|
| Windows | ― | 10 | 3.11.0 | 64 |
| Linux | Ubuntu | LTS 22.04 | 3.10.6 | 64 |
