1

I would like to do a similar service to censury.com.br, something that records my radio at certain times, in .mp3 files with different names according to the recording. EX: stream08-19-2019-22-00.mp3

I'm very new but ffmpeg sounds like the perfect way to record my favorite radio shows.

I like some specific times of three radios and a VPS with CentOS, to be able to record these programs would be amazing.

1 Answer 1

2

One time recording

You can use the at command do schedule a command or script:

at 14:30:00

A prompt will appear where you can enter your scheduled command:

at > ffmpeg -i input -t 01:00:00 -c copy "$(date +%F_%H-%M-%S).m4a"

The example above will record for one hour (-t 01:00:00).

To save press ctrl + d.

To view the scheduled job use the atq command.

Repetitive recording

You can use crontab to create cron jobs that will be executed on a periodic, fixed schedule:

crontab -e

Then enter your command:

0 16 * * 3 ffmpeg -i input -t 01:00:00 -c copy "$(date +%F_%H-%M-%S).m4a"

The above example will record every Wednesday at 16:00 for one hour (-t 01:00:00).

You can view your cron jobs with crontab -l.

5
  • Hi, llogan. Thanks for you fast reply. I believe that for my need the best option is crontab. Let's say I want to record this radio every Wednesday at 4:00 pm for an hour, would that be exactly the code? 0 2 * * wed ffmpeg -i c2901-slbps-sambavideos.akamaized.net/radio/… -t 01:00:00 -c copy radio.aac
    – Rodrigo
    Commented Aug 21, 2019 at 2:03
  • In the case of another radio record every Saturday from 20:00 to 22:00. 0 20 * * sat ffmpeg -i 167.114.103.39:8766/stream -t 02:00:00 -c copy anotherrecord.aac
    – Rodrigo
    Commented Aug 21, 2019 at 2:06
  • In either case, how would I make the recording file names have names according to the day?
    – Rodrigo
    Commented Aug 21, 2019 at 2:08
  • @Rodrigo Answer updated to address follow-up questions.
    – llogan
    Commented Aug 21, 2019 at 17:42
  • so cron starts counting days on sunday at index 0
    – Andrew
    Commented Jan 23, 2023 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .