hpr4294 :: Schedule audio recordings on the command line - A bit of fine tuning
Kevie tweaks the crontab command for better results with multiple recordings
Hosted by Kevie on Thursday, 2025-01-16 is flagged as Clean and is released under a CC-BY-SA license.
CLI, audio, streaming, radio, recording, ripping, music.
1.
Listen in ogg,
spx,
or mp3 format. Play now:
Duration: 00:05:18
general.
TuxJam co-host Kevie follows up on HPR4287 with a bit of a tweak to the Crontab, but still using the ffmpeg command to record.
In the previous episode, the example stream url that was given proved to be unpopular with ffmpeg due to the characters that it contained. A quick work around for this was to put it in a url shortener, for this example I'm using TinyURL .
Another issue arose when the stream recorded without first removing the audio file, I could see this being an issue when you want to record a show when you will be away over multiple weeks. To overcome this we simply edit the Crontab file (command
crontab -e
) and add the following to the end of the file, before the extension:
$(date +"%Y_%m_%d")
So the template chances from:
* * * * * ffmpeg -i https://streamurl -t HH:MM:SS /path/filename.ogg
to
* * * * * ffmpeg -i https://streamurl -t HH:MM:SS /path/filename$(date +"\%Y_\%m_\%d").ogg
I forgot to say in the show that you need to add \ before % in Cron or it will not behave as expected.
The example of recording Dan Lynch's Pic and Mix show on Arrow Radio every Thursday at 7pm would now be:
00 19 * * 4 ffmpeg -i https://tinyurl.com/msm6ya6f -t 02:00:00 ~/Recordings/DanLynchPickMix$(date +"\%Y_\%m_\%d").ogg