Skip to content

Instantly share code, notes, and snippets.

@Sg4Dylan
Last active December 4, 2017 10:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sg4Dylan/b08d6676f3fa278647c2adba2eb004d5 to your computer and use it in GitHub Desktop.
Save Sg4Dylan/b08d6676f3fa278647c2adba2eb004d5 to your computer and use it in GitHub Desktop.
树莓派 FM 转播 BBC / Broadcast BBC radio via RaspberryPi / 树莓派转播网络直播音频(以 Bilibili 直播为例)
#!/bin/bash
# Raspberry broadcast fm shell
# - A believing heart is your magic -
# Dependency:
# FFmpeg: pacman -S ffmpeg
# PiFmRds: https://github.com/ChristopheJacquet/PiFmRds
# BBC Radio
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1xtra_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio3_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4extra_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio5live_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_p"
# livelink="http://bbcmedia.ic.llnwd.net/stream/bbcmedia_asianet_mf_p"
livelink="http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-einws"
# broadcast frequency
broadcast_freq="77.0"
# PiFMrds
pfr_pi='66CC'
prf_ps='BBC Radio'
ffmpeg -i ${livelink} -vn -acodec pcm_s16le -ar 44100 -ac 2 -f wav pipe:1 | pi_fm_rds -freq ${broadcast_freq} -pi ${pfr_pi} -ps ${prf_ps} -rt 'broadcast BBC world service' -audio -
#!/bin/bash
# Raspberry broadcast fm shell
# - A believing heart is your magic -
# Dependency:
# streamlink: pip install streamlink
# FFmpeg: pacman -S ffmpeg
# PiFmRds: https://github.com/ChristopheJacquet/PiFmRds
# live url (in streamlink format)
livelink="live.bilibili.com/3"
# broadcast frequency
broadcast_freq="77.0"
# PiFMrds
pfr_pi='66CC'
prf_ps='BilibiliLive'
# command
streamlink -O ${livelink} best | ffmpeg -i pipe:0 -vn -acodec pcm_s16le -ar 44100 -ac 2 -f wav pipe:1 | pi_fm_rds -freq ${broadcast_freq} -pi ${pfr_pi} -ps ${prf_ps} -rt 'broadcast bilibili live room #3' -audio -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment