You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running MPV to get my radio station stream from an icecast server - struggled to get HLS metadata from an adts segment to update out of ffmpeg or mpv, so this is what I am doing to get icecast data to rds:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I am running MPV to get my radio station stream from an icecast server - struggled to get HLS metadata from an adts segment to update out of ffmpeg or mpv, so this is what I am doing to get icecast data to rds:
cat ~/.config/systemd/user$ cat stream.service
`
[Unit]
Description=Radio Aotearoa HLS Live Stream
After=pipewire-pulse.service
[Service]
Type=simple
ExecStart=/usr/bin/mpv --no-video --audio-device=pulse/AFProcessor --volume=100 --input-ipc-server=/tmp/mpvsocket --script-opts=osc=no https://[insert-your-icecast-url-here]
Restart=always
RestartSec=5
[Install]
WantedBy=default.target
`
cat :~/.config/systemd/user$ cat rds_bridge.service
`[Unit]
Description=RDS Metadata Bridge
After=stream.service
[Service]
Type=simple
ExecStart=/usr/bin/python3 /usr/local/bin/rds_bridge.py
Restart=always
[Install]
WantedBy=default.target`
cat /usr/local/bin/rds_bridge.py
`import socket
import json
import subprocess
import time
def send_to_rds(text):
# Truncate and strip whitespace/newlines
clean_text = text.strip()
# Use the proven rds95 syntax: rt1=Text
payload = f'rt1={clean_text[:64]}'.encode('utf-8')
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.sendto(payload, ("127.0.0.1", 5000))
sock.close()
except Exception as e:
print(f"UDP Error: {e}")
def get_mpv_title():
try:
cmd = 'echo '{ "command": ["get_property", "media-title"] }' | socat - /tmp/mpvsocket'
result = subprocess.check_output(cmd, shell=True).decode('utf-8')
data = json.loads(result)
return data.get("data")
except:
return None
last_title = ""
print("Bridge active. Watching for metadata...")
while True:
current_title = get_mpv_title()
if current_title and current_title != last_title:
print(f"New Track: {current_title.strip()}")
send_to_rds(current_title)
last_title = current_title
time.sleep(10) # 10-second polling interval`
All reactions