I played a show on UBC’s CiTR radio yesterday with my band, Lakefield. I was planning to record it with something like Rogue Amoeba’s Radioshift, until my brother asked me for “the magic UNIX incantation that will make VLC record the broadcast.” I didn’t know that you can schedule recordings with VLC!
Opening the door to VLC’s secret telnet interface
Alright, it’s not so secret. For my purposes, though, it was rather poorly documented.
First thing to do, is to launch VLC, and choose (VLC > Add Interface > Telnet Interface) from the menu bar. For non-Mac users, I believe this option lives under the “Settings” menu.
Don’t quit VLC at this point! You will need to keep it running from now until the end of your scheduled recording. Also, make sure that your computer is not set to sleep after a period of idle time, and that your housemates know not to shut the computer down or put it to sleep.
Connecting to VLC through telnet
VLC opens a telnet interface at port 4212 of your local machine. Mac users can launch the Terminal application (typically found in the “Utilities” subfolder of your “Applications” folder) to make a connection.
Open Terminal and type the following:
$ telnet localhost 4212
The password, by default, is admin.
Trying ::1... Connected to localhost. Escape character is '^]'. Password: Welcome, Master >
Once you’re in, you can start issuing commands directly to the VLC client.
Defining a broadcast
The “magic incantation” to define a broadcast, and the file to which you would like it saved, is as follows:
> new {name_of_broadcast} broadcast enabled input {url_of_broadcast} output #std{access=file,mux=raw,dst={path_to_which_to_save_broadcast}}Phew! In my case, where the broadcast I wanted to save streams from http://live.citr.ca:8000/stream.mp3, and I wanted VLC to save the recording to my Desktop folder, the incantation went as follows:
> new citr_radio broadcast enabled input http://live.citr.ca:8000/stream.mp3 output #std{access=file,mux=raw,dst=/Users/sluscher/Desktop/lakefield_show_stream.mp3}I called my broadcast citr_radio, but you can call yours whatever you like. Also, make sure that the path to your destination file exists.
Testing, testing – 1-2-3
At this point, the recording is ready for scheduling, but before we do that, let’s make sure that we spoke the magic words correctly. Here, we’ll use the control directive to test out our broadcast recorder. Incant the following:
> control citr_radio play
A file should appear at your destination path, and VLC should be dumping your broadcast into it. Let the tape roll for a few seconds, and then type this to stop it:
> control citr_radio stop
If all went well (and VLC doesn’t report any errors when you bring it to the foreground) then you should be able to open the file that was created with VLC and listen to what you’ve recorded!
Scheduling the recording
Once you’ve demonstrated that you can manually start and stop the recording, it’s time to schedule a recording. The scheduling syntax looks like so:
> new {name_of_schedule} schedule enabled date YYYY/MM/DD-HH:MM:SS append {command_to_run}The time is in 24 hour clock, based on your system clock, and name_of_schedule can be anything you like. In my case, I wanted to schedule a start and a stop coincident with my band’s performance on the radio:
> new lakefield_show_start schedule enabled date 2009/03/19-21:00:00 append control citr_radio play > new lakefield_show_end schedule enabled date 2009/03/19-23:00:30 append control citr_radio stop
Once you’ve set the trap, you can conclude your telnet conversation with VLC by typing:
> exit
Feel free to quit Terminal at this point, but leave VLC (and your computer) running until the end of the broadcast.
That’s that!
Here’s the whole magic spell:
$ telnet localhost 4212
Trying ::1...
Connected to localhost.
Escape character is '^]'.
Password: [the password is "admin"]
Welcome, Master
> new citr_radio broadcast enabled input http://live.citr.ca:8000/stream.mp3 output #std{access=file,mux=raw,dst=/Users/sluscher/Desktop/lakefield_show_stream.mp3}
> new lakefield_show_start schedule enabled date 2009/03/19-21:00:00 append control citr_radio play
> new lakefield_show_end schedule enabled date 2009/03/19-23:00:30 append control citr_radio stop
> exit
Connection closed by foreign host.
$…and for your listening pleasure, here is Lakefield on CiTR’s Thunderbird Radio Hell!
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.






