Record Live Radio Shows using ffmpeg
2 minutes read •
Over the last 3-6 months or so, I have listened to the radio more frequently as I multi-task or unwind, but I’ve listened since I was little. There’s something especially great about online-radio and being to listen-in from hundreds of miles away. It sounds washed but I’ve started listening to C-Span occasionally as of late. Maybe it’s the unfiltered perspectives or opinions seem realer when it’s a person saying them aloud? C-Span’s call-in show is broadcasted on TV, but it’s like 6am in the morning, and TV doesn’t allow multi-tasking anyways.
Here’s my config. It took a bit of tweaking over a week or two, but now it is at set-it-and-forget-it status.
cspan.service
Description=Script
ExecStart=/bin/bash
- I use opus because it seems to be the best audio codec, while being open-source and solid even at smaller bitrates.
- Originally, I saved the file directly to the folder that I planned on storing the file, but ran into issues when playing the file… Things like fast-forwarding/rewinding in Audiobookshelf would break and restart the episode. I think it’s related to Audiobookshelf reading the file’s metadata before it finished being created or something? Now, the file is saved in
/tmp/initially and then moved to the proper folder - Sometimes the show goes late and they take extra calls, so I record 3.5 hours status.
- Each recording is approximately 115M.
cspan.timer
Description=Record
OnCalendar=*-*-*
Persistent=true
WantedBy=timers.target
- Run the app daily @ 6am (CDT)
Persistent=truemeans that if the server got rebooted and turned on after 6am, the timer would still trigger
cspanCleanup (Service @ top, Timer @ bottom)
Since the show is covering the political topic-du-jour, the episodes become stale quickly. I delete episodes older than 5 days (and usually skip episodes older than 3 days old)
# Service File
Description=Create &
Type=oneshot
ExecStart=/bin/bash
# Timer File
Description=Daily
OnCalendar=
Persistent=true
WantedBy=timers.target