Open Broadcaster Software (OBS) streaming helper for YouTube Music Desktop.
Listens to the Playback interface of YTMD and outputs formatted track information and album art files which can be consumed by OBS.
Handy for streaming currently played song from YTMD and doesn't require configuration unless you want to customize the output.
- Automatically polls the YTMD Remote API for changes to the current track
- Output track information to a txt file which can then be used in OBS Studio
- Customizable track information display
- Output album art to a png file which can then be used in OBS Studio
- Customizable resolution
- Easy to use! (kinda... 😉)
Before using the script, you should make sure the YTMD remote control API is enabled. See the official docs for more details (Settings -> Integrations -> Remote Control). Also, make sure your firewall is configured properly by allowing access to Node.js and YTMD if they ask for it (this will vary based on the OS but most likely it will happen).
If you have prior Node.js experience, this should be no problem. If you don't, I tried to make things as easy as possible :
- Install Node.js v12 (or whichever LTS is available when you are reading this). Ensure the tools are installed in your PATH (for Windows, this should be an option in the installer).
- Download this repo. (Click here to download the latest version as a zip file)
- Extract somewhere you don't mind keeping it (for Windows, somewhere that doesn't require administrator access).
- Execute the
install.bat
file (Windows) orinstall.sh
file (Linux / macOS). You should be able to do that by double-clicking it. - Execute the
ytmd_output.bat
file (Windows) orytmd_output.sh
file (Linux / macOS). You should be able to do that by double-clicking it. - To close the script, use CTRL+C or close the command prompt window.
Steps 1 - 4 only have to be done once. After that, simply execute the relevant ytmd_output
file and let it run while YTMD and your streaming application are open.
To add the current track info, add a new Text (GDI+) source. Check the "Read from file" box and choose the "Current_Track.txt" file generated by this program.
To add the album art, add a new Image source and select the Current_Album_Art.png file generated by this program.
Open the config.json file in a text editor in order to change settings. Here are all the available settings.
Note: You can also look at the config.schema.json which contains the JSON schema for config.json. The config.json file will be validated against the schema before the script starts and any errors will be listed.
The file path where to write the text file containing the album art.
You can specify an absolute path in order to write it to a folder different from the script's location.
Note: An additional file corresponding to this filename followed by ".tmp" will also be written to the folder. This is required in order to resize the image.
Default: Current_Album_Art.png
The height of the album art to output in pixels.
Default: 500
Note: When the track played is a YouTube video, the cover art won't be square, but it will be resized to fit within the maximum given width and height.
The width of the album art to output in pixels.
Default: 500
Note: When the track played is a YouTube video, the cover art won't be square, but it will be resized to fit within the maximum given width and height.
The pattern to use when writing the current track information. You can both use symbols that will be replaced by the track information and plain text that will be left as-is.
Example: Track: %title% by %author%
would output Track: Never Gonna Give You Up by Rick Astley
.
You can also provide an array of strings, in which case each pattern will be written in a different file (you would then need to provide an array of filenames in the trackFilePath
option).
Example: ["File 1: %author%", "File 2: %title% (%album%)"]
would output to 2 different files specified in trackFilePath
.
Valid symbols : %title%
, %author%
, %album%
. Use \n
to insert a line break.
Default: %author%\n%title%\n%album%
Note: When the track played is a YouTube video, the album will be empty.
The interval between each request the script will make to the YTMD Remote API in milliseconds.
Default: 1000
The file path where to write the text file containing the track information.
You can specify an absolute path in order to write it to a folder different from the script's location.
Example: "track.txt"
would output the pattern specified in outputPattern
.
You can also pass an array of strings in order to output to multiple files.
Example: ["track1.txt", "track2.txt"]
would output 2 different files using the patterns specified in outputPattern
.
Default: Current_Track.txt
Full URL to the YTMD Remote API.
Default: http://localhost:9863/query
How long to wait before clearing out the track info after the player is paused or stopped, in milliseconds.
Example: If set to 3000
and the track gets paused for at least 3 seconds (exact timing depends on the polling interval), the track file and cover art will be deleted.
Default: undefined
Special thanks to YTMD for the awesome application and easy to use API!
For Google Play Music Desktop Player: https://github.com/Notuom/gpmdp-output