How to stream music from a live Youtube (Chillhop) in OBS?

As a professional streamer on Twitch for several years, over time I have developed skills and an audience that allows me to work live on Mondays, Tuesdays and Thursday afternoons.

Of course, chatting with people in the chat is cool. But with some background noise, it’s better!

But you can’t stream music on Twitch because otherwise they cut the audio for copyright issues.

So I went to the Chillhop site which offers Lo-Fi / Chill tracks perfect for creating a nice background sound in my stream. To integrate their music, I then had 2 choices: stream their playlist via Spotify or stream their YouTube live, directly from OBS.

Spotify, I use it to listen to my copyrighted music all day, so I couldn’t dedicate it to that. So I created a browser of origin by loading my HTML page that allowed to play the Chillhop playlist in autoplay.

It was nice and it worked well. Until the day Chillhop (or YouTube) blocked autoplay on her Lives.

More background music on my streams. I was sad. Then, after a while, my millions of viewers started asking me about background music.

Listening only to my self-sacrifice towards them, I then decided to find the show to stream a live YouTube on OBS. I will walk you through all of this, step by step. Remember to send the URL of this article to your favorite streamer.

So I switched (thanks to the advice of my community) on the VLC option that allows you to do everything and above all to play a YouTube video directly from the player like this (I’m on macOS, but for Windows or Linux it’s the same principle):

/Applications/ ''

I know, there is a VLC source in OBS, but I never got it working properly. So I started on VLC, but loaded outside of OBS.

I just don’t need the video, just the sound. So I added this parameter:

/Applications/ '' --no-video

At the moment, the software I use for my mixer (Loopback) is not yet compatible with the latest version of macOS. So I couldn’t get the sound from VLC.

So I had to do without it.

I therefore committed myself to creating, again with VLC, a Chillhop YouTube live streaming, accessible via the URL http: // localhost: 2323 which I could then upload to a “Media Source” source in OBS.

So it gives this:

/Applications/ '' --no-video --sout '#standard{access=http,mux=ogg,dst=localhost:2323}'

Impeccab ‘as chef Michel Dumas would say. I can then create my new media source in OBS and have the Chillhop sound.

But there are two problems with this command line:

  • I have to think about launching it before starting my live. And
  • t when I start it, it starts VLC which is then visible like this:

It’s bad and if I close the terminal or VLC by reflex, it stops the music.

So, to hide the VLC interface, start it with this parameter:

/Applications/ -I http '' --no-video --sout '#standard{access=http,mux=ogg,dst=localhost:2323}'

Flawless’ again.

However, thinking about throwing it every time sucks. This is where I learned about the existence of scripts in OBS. In fact, we can code scripts to interact with OBS, both in Python and in LUA. I am a Python fan so I think it will be burned soon, but unfortunately I had specified the right Python interpreter in OBS, impossible to run any Python script. Even a hello world didn’t work.

I couldn’t even spend hours on it, so I fell back on LUA. So I generated this script in LUA to call my VLC command line. You’ll see, that’s several hundred lines of ultra-complex code. No, I’m kidding, it’s just a shit joke:

-- Script LUA pour charger la musique de Chillhop dans OBS -

os.execute("/Applications/ -I http '' --no-video --sout '#standard{access=http,mux=ogg,dst=localhost:2323}'")

I saved this script by naming it chillhop.lua, so I went to OBS, “Tools”> “Script” menu and simply added my Lua script into it:

I restarted OBS and there I realized it was blocking all my OBS. In fact, by loading, VLC blocks the rest of the application loading. So I added a little & to the end of the command so that OBS immediately takes over and you don’t wait like crazy for VLC to finish.

os.execute("/Applications/ -I http '' --no-video --sout '#standard{access=http,mux=ogg,dst=localhost:2323}' & ")

And that’s it, it works. OBS starts up, runs the LUA script which in turn starts VLC in the background to play the music and OBS can then retrieve the sound broadcast via the localhost address in its media source. It is transparent and fast.

The interesting thing about all of this is that it opens up a world of possibilities for augmenting and driving OBS when scripting. It is therefore a question of digging. All I need now are good ideas.

Leave a Reply

Your email address will not be published. Required fields are marked *