How to create a file that tells VLC media player to start recording a stream

audio-streamingautohotkeyplsstreamingvlc-media-player

A PLS file can tell VLC media player and other players to start playing an online radio. VLC is also capable of recording an audio stream to a file.

Currently I tell VLC to do this manually, and it requires many clicks. I would like to automate this task by creating a PLS or other kind of file that do that for me. I will just have to open the file in VLC, and it will start to record the stream. Is that possible? Or will I have to create a macro in AutoHotkey? Or there is another tool that could help me?

Best Answer

The easiest way to control VLC streaming is from the command line. While you could learn the syntax needed to control VLC in this manner, you can make the GUI do most of the work for you.

  1. Open the Media menu and select Streaming...
  2. Select any file or network stream, it doesn't matter which one. You'll still have to specify the exact stream you want to record later.
  3. Choose Stream.
  4. The Source window will appear, with the location of your stream pre-filled. Click Next.
  5. The Destination screen appears now. Under Destinations, File should be selected by default. Click Add to the right of that drop-down box.
  6. Choose the filename and location where you want to save the stream. You can select the right place now, or change it in the actual command to VLC.
  7. Choose the desired output format in the Transcoding section.
  8. Click Next to advance to the Miscellaneous Options screen.
  9. At the bottom there is a box labeled Generated stream output string. That is the command string you need to pass to VLC to replicate the output operation you just described. An example is highlighted in blue below:

VLC

Go ahead and copy that string. At the simplest, you can create a shortcut somewhere like your desktop that will run VLC and start recording the stream. Just copy the existing VLC shortcut by right-clicking on the VLC icon on your desktop, selecting Send to, and choosing Desktop (as shortcut), then right-click on the new shortcut and click Properties. In the Target box, add a space after the closing quote at the end, and then enter the address of the stream you want to record. Then, add another space and paste in the stream output string you copied earlier. If you need to change the save location, its located right after {dst= and before the closing } in the string. The whole thing should look something like this:

"C:\Program Files\VideoLAN\VLC\vlc.exe" http://www.superuser.com/unicorns.mpg :sout=#transcode{vcodec=theo,vb=800,scale=1,acodec=vorb,ab=128,channels=2,samplerate=44100}:file{dst=C:\\Users\\Patches\\Videos\\unicorns.ogg} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep

Now you can just double-click that icon (or launch it with a hotkey) to record the stream.

Related Question