{"id":12,"date":"2025-02-09T17:49:16","date_gmt":"2025-02-09T17:49:16","guid":{"rendered":"https:\/\/c2dan88.duckdns.org\/golb\/?p=11"},"modified":"2025-07-01T18:42:50","modified_gmt":"2025-07-01T17:42:50","slug":"stream-audio-from-pi","status":"publish","type":"post","link":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/2025\/02\/09\/stream-audio-from-pi\/","title":{"rendered":"RaspberryPi Stream Audio"},"content":{"rendered":"\n<p>Install ffmpeg and pulseaudio<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\">sudo apt install ffmpeg pulseadio<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>transmit_audio.sh<\/strong><br><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong>NOTE:<\/strong> Change 192.168.1.100 to the ip address of the device you want to stream the audio too<\/mark><\/em><\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\">#!\/bin\/bash\n\nif [ -z &quot;$1&quot; ]\nthen\n\tffmpeg -f pulse -i &quot;remote.monitor&quot; -ac 2 -acodec pcm_s16le -ar 48000 -f s16le &quot;udp:\/\/192.168.1.100:18181&quot;\nelse\n\tpkill -15 ffmpeg\nfi<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\">In your desktop environment setup a login action to start transmit_audio.sh and for the logout action transmit_audio.sh passing stop as an argument.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">On the receiving device run this script.<br>audio_stream.sh<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-bash\">#!\/bin\/bash\n\npkill -f &quot;ffplay&quot;\n\nffplay -nodisp -ch_layout stereo -acodec pcm_s16le -ar 48000 -analyzeduration 0 -probesize 32 -f s16le -i udp:\/\/0.0.0.0:18181?listen=1 -threads 2 #&amp;&gt; \/dev\/null<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install ffmpeg and pulseaudio transmit_audio.shNOTE: Change 192.168.1.100 to the ip address of the device you want to stream the audio too In your desktop environment setup a login action to start transmit_audio.sh and for the logout action transmit_audio.sh passing stop as an argument. On the receiving device run this script.audio_stream.sh<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":5,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":60,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions\/60"}],"wp:attachment":[{"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.c2dan88.co.uk\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}