Search code examples
shellffmpegterminalscheduleat-command

How can I get ffmpeg to start downloading a stream at a specific time?


If I know that a livestream is starting in a few hours, and I know the url of the livestream. If the stream is currently happening I have no problem using ffmpeg to save the stream to file. However, I am currently looking all over the web to find if there is a way for me to schedule a command to execute in the future. I have tried using "at", but that still seems to run the command in the present. I am wondering if "at" is the answer to my problem or if it is something else? Thank you.

I have tried using the at command and looking for other applications on MacOS to schedule commands.

Here is an example of the ffmpeg command that works perfectly for my intentions when I type it into the command line at present. What I am hoping is that I can get ffmpeg to start reading from the stream at a specific date and time and start writing to file from there.

ffmpeg -loglevel panic -nostdin -i [WEB_URL] -c:a aac -b:a 320k -crf 33 out.mp4

Here is my unsuccessful attempt to use at:

at 22:53; ffmpeg -loglevel panic -nostdin -i [WEB_URL] -c:a aac -b:a 320k -crf 33 out.mp4 & 

What I expected was for ffmpeg to work as if I had entered in the command at the instant I scheduled the job for. However, ffmpeg started working immediately.


Solution

  • I believe that I have found the way to do what I was hoping to do using cron jobs.