command line texting over youtube live

Here is a basic setup that will let you send text to a friend using youtube live as a relay.
The flow looks like this:

sender                                    receiver
text -> minimodem -> ffmpeg -> youtube -> streamlink -> ffmpeg -> minimodem -> text
Important: this setup needs a modified version of minimodem which will pipe output in the form of an .AU file. I have modified the source code to do just that, and you can get it from this github repo. If you are trying to build minimodem for windows, here are instructions  to help you build it with cygwin.
After building this modified version of minimodem from source, install streamlink and ffmpeg.

Test to make sure everything is working correctly in your terminal:

echo "hello" | minimodem --tx tdd
(it should play a sound)
ffmpeg -version
(it should say the version)
streamlink --version
(it should say the version)

For the sender, first get your youtube stream name/key code from http://youtube.com/live_dashboard.
Then, create a 1280x720 png file called blank.png and put it in your current directory in your terminal.
Now replace the text STREAMKEY with your actual youtube key code (e.g. replace STREAMKEY with abcd-3018-fasd-3141) and run the following:

minimodem --tx 100 -f - | ffmpeg -loglevel panic -re -loop 1 -framerate 2 -i blank.png -i pipe:0 -c:a aac -s 1280x720 -ab 128k -maxrate 512k -bufsize 512k -framerate 30 -g 60 -strict experimental -f flv "rtmp://a.rtmp.youtube.com/live2/STREAMKEY"
Check back on the youtube live dashboard page and it will start to receive the feed in a few moments. Once it starts up, right click the video and click Copy video URL and give that to your friend.

For the receiver, replace the text STREAMURL with the actual youtube video URL (e.g. replace STREAMURL with https://youtu.be/abcdefghijkl) and run the following:

streamlink --hls-live-restart -o - STREAMURL best | ffmpeg -loglevel panic -i pipe:0 -ac 1 -f wav - | minimodem -q --rx -f - 100
Now, when the sender types something into his terminal, it will send it to youtube, which can be deciphered from the receiver's terminal.
This seems like a fun starting point for something larger, maybe. It was created just for fun.
last updated May 7, 2019 by fanfare.