9

I work at a school and have setup a workstation to broadcast/stream the morning announcements for the teachers and kiddos. Teachers in the classroom access this stream via Windows Media Player or VLC...however, sometimes the teacher is running late, or their computer is having issues, so as a courtesy, I record them from my Ubuntu machine through VLC's magical red record button. From there, I upload them to a Google Drive folder that they have access to and problem solved. However, I am not always in my office first thing in the morning (resulting in some days without recordings).

The announcements start at the same time every day (that is, M-F) at 7:55 and run to about 8:05 (5~10 minutes depending on how much content there is).

Can someone please help me with a cron/command/script for VLC to automatically record our announcements daily at the specified time?

8

You can use two cron lines like this to make a ~10 minute recording from 0755.

55 7 * * 1-5  cvlc --run-time=5 --sout file/ts:stream.mp4 htsp://@ip:9982/211
5  8 * * 1-5  sh -c "killall cvlc; cp stream.mp4 /path/to/upload"

I've added 1-5 in the fifth field so it only runs Monday to Friday.

VLC is hard to stop recording without actual controls. The easiest way it to just tell it to die. That's what the second line does... And then does something (up to you) with the saved file.


There is a small problem in that the teacher is going to have to skip to the right moment... What if the video is longer than 10 minutes one day? The best possible solution is going to involve somebody making the video having manual control.

  • Thank you for the crons above! I will play with this today and report back~! Also, I understand and appreciate the concern...but with all other staff handling so many other tasks, this is not feasible. The show will never go over 10 minutes...it goes like this: U.S./Texas Pledge/Moment of silence>Lunch Menu>the day's activities/events>goodbye. Because instructional time in the classroom is precious, the show cannot and will not go beyond 8:05... – neonBlaque Jan 15 '15 at 15:29
  • Might I ask, what the /211 after port 9982 in your answer is?? or is that just an alternate example port for reference? – neonBlaque Jan 15 '15 at 15:37
  • That's just part of the stream I tested on. I was streaming from a TVHeadend server connected to a satellite dish at home and that's the channel. That whole URL (htsp://@ip:9982/211) will likely look very different for you. – Oli Jan 15 '15 at 15:38
  • I just tried this method, but cvlc issues always an error message: " HTTP/1.1 400 Bad Request". Is there any way to do this from the VLC interface itself? – Luís de Sousa Nov 26 '16 at 10:22
  • On systemd you can use timers instead of cron. – Pablo Bianchi Mar 10 at 18:21

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.