1

I've followed a bunch of guides regarding ALSA, Pulseaudio, JACK, etc., but none have seemed to work. I'll be specific with what I'm trying to do. On a cloud-based Debian VM, I want to:

  • Open a stream using cvlc
  • Start an icecast2 server on the same system
  • Capture the audio stream from cvlc using darkice and send it to the local icecast2 server

However, a cloud VM doesn't have an audio card. So I'm trying to set up a virtual device to make this work. So far, I've had no luck.

Why would I want to do this? Simple. There are several vloggers I follow who do live shows. They provide a podcast recording later on in the day, but they don't provide a live audio stream. I'd like to listen to them live when I'm out and about, but streaming YouTube is a great way to eat up your mobile data.

So, I want to:

  1. Set up a small cloud server
  2. Play their video stream with cvlc
  3. Capture the cvlc audio with darkice
  4. Re-broadcast the audio to a local icecast2 server

I've gotten it to work in pieces. I'm able to:

  • Get icecast2 running on a cloud server
  • Use my laptop to play the video stream with cvlc
  • Capture the stream's audio with darkice (also on my laptop) and send it to the icecast1 instance on the cloud server

However, I can't figure out how to get all the pieces working on the sound card-less cloud server. I know it can be done, and I know it requires setting up a virtual sound card. I've modprobe'd and pactl'd a lot of things, but I just can't get it to work.

Sorry to be long-winded, but I wanted to be explicit.

1 Answers1

0

I managed to figure it out thanks to the following post: https://stackoverflow.com/questions/40061291/linux-without-hardware-soundcard-capture-audio-playback-and-record-it-to-fil

First, install the required programs:

sudo apt-get install -y darkice icecast2 pulseaudio jackd2 alsa-utils dbus-x11

If you want to use VLC, this will install the bare-minimum VLC without X:

sudo apt-get install vlc vlc-plugin-video-output x11-utils- xdg-utils- vlc-plugin-samba- fonts-freefont-ttf- libnotify4-

I'm assuming you know how to set up darkice and icecast properly. The key is starting everything in the right order and with the right administrative rights (jackd needs to be run as sudo, it seems):

sudo service icecast2 start
sudo jackd -r -ddummy & sleep 0.25 ;
pulseaudio -D & sleep 0.25 ;
darkice -c darkice.cfg & sleep 0.25 ;

If you are using VLC, play your audio, and it should work:

cvlc --network-caching 10000 --no-video [file-or-url]

That's it! I created a public Gist for my own sanity if you want a more detailed write-up: https://gist.github.com/summersab/43d83fbfecaf9dffa665bacdc39cba10

I'd like to run this in Docker, but I can't get Icecast working - something to do with sockets, and I don't think I want to go down that path.