Title is misleading at best.Reply
Doesn't an icecast server already do what broadcast-server does? You post an audio stream to it and it relays that to clients. What am I missing?Reply
If I write a complex piece of software that does something even marginally interesting, I'm going to post it to HN with a similar title. After all, I'm sure I can execute it with one line of bash, so the title is appropriate, right?Reply
I mean, you could probably launch nuclear missiles with a line of bashReply
Coincidentally today is the anniversary of the first public radio broadcast in 1910.Reply
Next post of this type is "execute any arbitrary binary with one line of bash"Reply
That's 3 lines of "bash." Not one.Reply
I did something similar so I could listen to my vinyl records over an in home ip radio station on my Sonos without buying their $500 box that lets you add arbitrary audio input.Reply
Nobody has problems with dropped TCP connections when streaming?
Tried icecast2 on several servers at distinct hosters and audio tag on various browsers and platforms, in maybe tens of minutes it always seized up. I had to add script to client page had to detect it and reconnect, the pauses were annoying, gave up.
Did not dig deeper seems as if routers drop the connection when there are no data transmitted in one direction.Reply
I think the dissenting / mocking comments here are missing the spirit of the post.
Since bash can evoke any Turing complete program, feasibly anything could be done with one line of bash.
The authors intent as I saw was to show what that line was. Would you have known without this article?
Whether or not people are just being sarcastic, I feel we should definitely not mock but rather encourage any open and free attempts at teaching us cool things that are more novel than the “how to get started on Linux” type bs the market is inundated with.
Bravo to author.Reply
Do whatever in one line: 1) Open a source code with Sublime 2) Ctrl+J to join the lines 3) EnjoyReply
The examples use "broadcast.schollz.com" as a service. How do I do it on a local network?Reply
Record the mic to a remote server:
ffmpeg -nostdin -f alsa -i pulse -c:a libmp3lame -ar 44100 -b:a 128k -ac 1 -f mp3 - | ssh -C vps "cat - > /var/www/output-$(date '+%s').mp3"
Fascinating. I recall two other interesting uses of ffmpeg: to stream to twitch, and to record video.Reply
This is really cool. I have a little node.js script I wrote that generates a funky little beat I call "egypt.js" and outputs the PCM data to stdout, just for weird things like this.
My local WSL1 install of ffmpeg has an issue with the LAME encoder so using a few extra pipes I was able to get this working! Confirmed with a friend they were able to listen across the planet.
Neat stuff! I love things like this.Reply
node /tmp/egypt.js | ffmpeg -f f64le -ar 176400 -i pipe: -f wav - | lame - - | curl -s -k -H "Transfer-Encoding: chunked" -X POST -T - "https://broadcast.schollz.com/egypt.mp3?stream=true&advertise=true"
Browse the Internet with one line of Bash:
But seriously, the commands in the article are not Bash commands (they don't even use Bashisms) and are valid in any POSIX-compliant shell.Reply
ffmpeg -f avfoundation -i ":1"
This article isn't very useful for a "one liner radio", but I use icecast2 in a couple of ways
1. I host a VGM radio  2. I use a combination of icecast2 and darkice to have a full home audio networking.
With the home audio network, there's a lot to optimize, but I haven't implemented it much more to experiment with it further.
Basically I have a Ubuntu Desktop VM on my home server. A long range bluetooth receiver  is feed from Proxmox host into the VM. The audio from the Bluetooth source (say your phone or your computer) is pulled from Darkice and renders an MP3 file/stream into Icecast2, which then broadcasts it on 10.0.0.10:8000/home I can use devices like Raspberry Pis to continuously listen on that URL for playback and play if it's available. There's CLI audio players like mpg123.
This could be used for whole home audio playback, but there's weird quirks to deal with like the delay between the audio in and when you hear it, as well as it becoming desynced over time.
It can also be setup in reverse where a RPi ingests audio from it's audio jack and sends it to the audio hub VM and the audio hub sends it out to the network.Reply