Record live video streams with VLC

Reading time: 3 minutes

VLC

VLC isn’t only a popular and very good media player available for many platforms, but it can also record live video streams.
The first step is to download and install the latest version of VLC, if you already didn’t.

The followind guide is based on Windows, but it can be easily adapted to other OS.

VLC allows to open live video streams, and it supports various protocols.
Click the Media tab and then click Open Network Stream… and insert a valid URL, then press Play.
The live video stream will start playback.

VLC

Once the video stream connection has been established, you can record it.

The record commands are displayed under the Playback tab. To record the video, click Record, click it again to stop recording.

VLC

The recorded videos are automatically saved to Documents folder of your Windows profile, you will find a file named with .ts extension that you can open with VLC or convert it in another format with one of many video converter software available.
IF you want to change the folder where the recordings are saved select Tools -> Preferences, now select for Input & Codecs then Files: Record Directory or Filename (put a valid path).

Lets go further, VLC also allows to record live video stream using command line, so you can schedule a batch at certain time.

Open a text editor and write the following string:

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" https://xxxxxx.net :sout=#duplicate{dst=file{dst=C:\Users\name\Desktop\record.ts},dst=display} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep --run-time=30 vlc://quit

Save the file where you want and give it a name, for example RecordVLC.bat.

Explaination of the string:

https://xxxxxx.net – URL of the live video stream
{dst=file{dst=C:\Users\name\Desktop\record.ts} – destination path and filename (change the name with the name of your Windows profile)
dst=display – automatically display the live video stream when VLC opens
–run-time=30 – recording time in seconds
vlc://quit – close VLC at end

Now we have just to use Windows Task Scheduler (you can open it from Windows Control Panel or by running taskschd.msc) to create a new task and run the batch file at the desidered day/time.

Alternatively you can use FFmpeg from command line, eg.: ffmpeg -i http://[IP]:[PORT] -t 60 -c copy C:\test.ts (the live stream will be recorded in .ts format (Transport Stream) for 60 seconds).

If you want to have a more rich batch we can add email notification feature by sending an email before the record start and at the finish, there are various free utilities that allows to send emails using SMTP protocol from command line, one of the best is SwithMail.

You can configure the settings easily with the GUI and save as .XML format, then pass it using CLI, or generate directly the string for the command line.

I modified the previous batch file adding the lines that allows to send emails using a Gmail account, you just have to replace the sender email address with your Gmail address, “Gmailpassword” with your own password and the recipient email address.
Be carefull, to allows the email sending using Gmail you have to enable Less secure apps on your Google account.

SwithMail.exe /s /from [email protected] /pass Gmailpassword /server smtp.gmail.com /p 587 /SSL /to recipientemailaddress /sub "Start VLC recording" /b "Start VLC recording"
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" https://xxxxxx.net :sout=#duplicate{dst=file{dst=C:\Users\name\Desktop\record.ts},dst=display} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep --run-time=30 vlc://quit
SwithMail.exe /s /from [email protected] /pass Gmailpassword /server smtp.gmail.com /p 587 /SSL /to recipientemailaddress /sub "End VLC recording" /b "End VLC recording"

If you want to power off computer at the end you just have to add the shutdown command:

SwithMail.exe /s /from [email protected] /pass Gmailpassword /server smtp.gmail.com /p 587 /SSL /to recipientemailaddress /sub "Start VLC recording" /b "Start VLC recording"
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" https://xxxxxx.net :sout=#duplicate{dst=file{dst=C:\Users\name\Desktop\record.ts},dst=display} :no-sout-rtp-sap :no-sout-standard-sap :ttl=1 :sout-keep --run-time=30 vlc://quit
SwithMail.exe /s /from [email protected] /pass Gmailpassword /server smtp.gmail.com /p 587 /SSL /to recipientemailaddress /sub "End VLC recording" /b "End VLC recording"
shutdown -s -f -t 10 -m \\ComputerName

Just change ComputerName with the name of your computer, using the parameter -t 10, the PC will power off after 10 seconds.

Support This Site

If you like what I do please support me on Ko-fi

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Commenti
Inline Feedbacks
View all comments