I found a Mac OS X hint yesterday mentioning how VideoLAN CLient (VLC) can save streaming videos into a file. Since today I wanted to record a radio show off the Internet, I gave it a shot for an audio stream too.

Here's what I got:

If you want to save a Quicktime (AAC/MP4) audio stream (maybe others, too? Leave a comment if you know!) to a file, start VLC from the command line (terminal window) like this:

/Applications/VLC.app/Contents/MacOS/VLC --rtsp-tcp rtsp://example.com/path/to/stream --sout '#standard{access=file,mux=mp4,url=/Users/Shared/VLCoutput.mp4}'

Now, if you want to schedule the whole thing, a cron job will do the job. The tool at would be certainly more correct (since you don't want to schedule it as a recurrent task), but the at daemon is disabled on OS X by default.

So, do a crontab -e and put in two lines like this (yes, put the whole VLC stuff into one line as mentioned above):

0 15 12 5 * /Applications/VLC.app/Contents/MacOS/VLC --rtsp-tcp rtsp://example.com/path/to/stream --sout '#standard{access=file,mux=mp4,url=/Users/Shared/VLCoutput.mp4}' 30 15 12 5 * killall -QUIT VLC

The first line starts VLC as mentioned above. 0 15 12 5 means: Start at 3 p.m. (= 0 15), on May 12 (= 12 5). The asterisks in each of the lines just mean that you don't care about the weekday. <!--more--> The second command, accordingly, stops recording at 3:30 p.m. by killing the VLC process. Two notes on that:

First, keep in mind to sind the QUIT signal rather than TERM (which would be the default), otherwise VLC won't correctly finish writing the file and probably render it unusable.

Second, killall is the mass murderer of the kill() commands. It will kill all running instances of VLC, not just the one recording your stream. So, don't wonder if the movie you happen to be watching stops playing at the scheduled time.

Save it and you are all set: Your stream will be recorded at the right time. You will find your stream in the Users/Shared/ folder, as specified in the VLC command line.

Eventually, when everything is done, you do a crontab -e again, and remove the two lines so that it won't start recording again, a year from now ;)

Have fun listening!

Was this helpful? Buy me a coffee with Bitcoin! (What is this?)

Updating Adobe Flash Without Restarting Firefox

No reason for a Flash upgrade to shut down your entire browser, even if it claims so.It's 2015, and the love-hate relationship of the Web...… Continue reading

Reddit's Fail-Alien (or "Fail-ien?")

Published on January 15, 2015