TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Make an internet radio station with one line of bash

153 pointsby qrv3wover 3 years ago

20 comments

junonover 3 years ago
This is really cool. I have a little node.js script I wrote that generates a funky little beat I call &quot;egypt.js&quot;[0] and outputs the PCM data to stdout, just for weird things like this.<p>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.<p><pre><code> node &#x2F;tmp&#x2F;egypt.js | ffmpeg -f f64le -ar 176400 -i pipe: -f wav - | lame - - | curl -s -k -H &quot;Transfer-Encoding: chunked&quot; -X POST -T - &quot;https:&#x2F;&#x2F;broadcast.schollz.com&#x2F;egypt.mp3?stream=true&amp;advertise=true&quot; </code></pre> Neat stuff! I love things like this.<p>[0] <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;Qix-&#x2F;7c131c6eb83bef7c44ef6faaf1eab106" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;Qix-&#x2F;7c131c6eb83bef7c44ef6faaf1eab10...</a>
twobitshifterover 3 years ago
Coincidentally today is the anniversary of the first public radio broadcast in 1910.<p><a href="https:&#x2F;&#x2F;www.edn.com&#x2F;1st-public-radio-broadcast-january-13-1910&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.edn.com&#x2F;1st-public-radio-broadcast-january-13-19...</a>
darau1over 3 years ago
Fascinating. I recall two other interesting uses of ffmpeg: to stream to twitch[1], and to record video[2].<p>[1] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;54273291&#x2F;streaming-a-stream-from-website-to-twitch-with-ffmpeg" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;54273291&#x2F;streaming-a-str...</a><p>[2] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HO6oU5oT6uU" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=HO6oU5oT6uU</a>
评论 #29929564 未加载
technoplatoover 3 years ago
I think the dissenting &#x2F; mocking comments here are missing the spirit of the post.<p>Since bash can evoke any Turing complete program, feasibly anything could be done with one line of bash.<p>The authors intent as I saw was to show what that line was. Would you have known without this article?<p>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.<p>Bravo to author.
评论 #29925351 未加载
评论 #29927583 未加载
评论 #29930138 未加载
评论 #29929930 未加载
评论 #29928687 未加载
belterover 3 years ago
If the network is down...Carry on. The music can&#x27;t stop.<p>&quot;System Bus Radio&quot; <a href="https:&#x2F;&#x2F;github.com&#x2F;fulldecent&#x2F;system-bus-radio" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;fulldecent&#x2F;system-bus-radio</a>
bin_bashover 3 years ago
I mean, you could probably launch nuclear missiles with a line of bash
评论 #29924343 未加载
评论 #29926358 未加载
评论 #29924158 未加载
buscoquadnaryover 3 years ago
Next post of this type is &quot;execute any arbitrary binary with one line of bash&quot;
Drybonesover 3 years ago
This article isn&#x27;t very useful for a &quot;one liner radio&quot;, but I use icecast2 in a couple of ways<p>1. I host a VGM radio [1] 2. I use a combination of icecast2 and darkice to have a full home audio networking.<p>With the home audio network, there&#x27;s a lot to optimize, but I haven&#x27;t implemented it much more to experiment with it further.<p>Basically I have a Ubuntu Desktop VM on my home server. A long range bluetooth receiver [2] 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&#x2F;stream into Icecast2, which then broadcasts it on 10.0.0.10:8000&#x2F;home I can use devices like Raspberry Pis to continuously listen on that URL for playback and play if it&#x27;s available. There&#x27;s CLI audio players like mpg123.<p>This could be used for whole home audio playback, but there&#x27;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.<p>It can also be setup in reverse where a RPi ingests audio from it&#x27;s audio jack and sends it to the audio hub VM and the audio hub sends it out to the network.<p>[1] <a href="https:&#x2F;&#x2F;vidya.fm" rel="nofollow">https:&#x2F;&#x2F;vidya.fm</a> [2] <a href="https:&#x2F;&#x2F;www.amazon.com&#x2F;gp&#x2F;product&#x2F;B07KTK8YP3&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.amazon.com&#x2F;gp&#x2F;product&#x2F;B07KTK8YP3&#x2F;</a>
评论 #29928320 未加载
oklover 3 years ago
Title is misleading at best.
spythonover 3 years ago
Does anyone have experience with <a href="https:&#x2F;&#x2F;www.liquidsoap.info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.liquidsoap.info&#x2F;</a> for simple radio stations? Is it any good?
评论 #29929571 未加载
rdelpretover 3 years ago
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.
rini17over 3 years ago
Nobody has problems with dropped TCP connections when streaming?<p>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.<p>Did not dig deeper seems as if routers drop the connection when there are no data transmitted in one direction.
hffftzover 3 years ago
Record the mic to a remote server:<p><pre><code> ffmpeg -nostdin -f alsa -i pulse -c:a libmp3lame -ar 44100 -b:a 128k -ac 1 -f mp3 - | ssh -C vps &quot;cat - &gt; &#x2F;var&#x2F;www&#x2F;output-$(date &#x27;+%s&#x27;).mp3&quot;</code></pre>
soheilover 3 years ago
For osx:<p><pre><code> ffmpeg -f avfoundation -i &quot;:1&quot;</code></pre>
kingosticksover 3 years ago
Doesn&#x27;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?
评论 #29939624 未加载
marcodiegoover 3 years ago
The examples use &quot;broadcast.schollz.com&quot; as a service. How do I do it on a local network?
评论 #29930919 未加载
qwertyuiop12over 3 years ago
Do whatever in one line: 1) Open a source code with Sublime 2) Ctrl+J to join the lines 3) Enjoy
charcircuitover 3 years ago
That&#x27;s 3 lines of &quot;bash.&quot; Not one.
b215826over 3 years ago
Browse the Internet with one line of Bash:<p><pre><code> firefox https:&#x2F;&#x2F;news.ycombinator.com </code></pre> But seriously, the commands in the article are not Bash commands (they don&#x27;t even use Bashisms) and are valid in any POSIX-compliant shell.
评论 #29926806 未加载
评论 #29928683 未加载
slingnowover 3 years ago
If I write a complex piece of software that does something even marginally interesting, I&#x27;m going to post it to HN with a similar title. After all, I&#x27;m sure I can execute it with one line of bash, so the title is appropriate, right?
评论 #29930447 未加载