I'm trying to set VLC to record a live stream on YouTube using cron. Vlc records videos that aren't live streaming just fine, but when the stream is live VLC records at most only 24 seconds. Why does it stop there? How can I get it to record more?

The lines I have in my crontab file were adapted from the answer to this question:

35 21 20 3 * cvlc --sout file/ts:/path/to/directory/file.mp4 <link to video>
37 21 20 3 * sh -c "killall cvlc; killall vlc"

3 Answers 3


For livestreams I would recommend using livestreamer instead of VLC. Recording with livestreamer is a breeze, e.g.:

livestreamer <livestream-url> best -o vod.mp4

livestreamer supports dozens of different streaming providers and works very reliably, even with spotty streams.

For installation instructions check out this answer by @henry.

  • 1
    livestreamer is now deprecated and forked to streamlink.
    – Igor V.
    Aug 29, 2018 at 7:52

According to livestreamer manpage, options must come first:

$ livestreamer [OPTIONS] [URL] [STREAM]

These will show you streams you can choose from:

$ livestreamer [URL]


$ livestreamer [OPTIONS] [URL]

This will save the best quality available stream to file arq.mp4 in the current dir:

livestreamer -o arq.mp4 <livestream-url> best


$ man livestreamer 

for many more details.



livestreamer is no longer maintained. Use Streamlink instead

Install (install --upgrade to upgrade):

sudo -H pip install streamlink

Then just

streamlink --output stream.mp4 "https://www.youtube.com/freecodecamp/live" best # or worst

You can also send the stream to cvlc with any parameter you may want

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .