9

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"
Zanna
  • 70,465
user2980766
  • 843
  • 2
  • 11
  • 19

3 Answers3

15

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.

Glutanimate
  • 21,393
0

Streamlink

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

Pablo Bianchi
  • 15,657
0

According to livestreamer manpage, options must come first:

COMMAND-LINE USAGE
$ livestreamer [OPTIONS] [URL] [STREAM]

These will show you streams you can choose from:

$ livestreamer [URL]

or

$ 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

Check

$ man livestreamer 

for many more details.

Pablo Bianchi
  • 15,657