1

I've created the following crontab:

0/5 * * * * /Applications/VLC.app/Contents/MacOS/VLC -I rc rtp://@xxx.xxx.xxx.xxx:5050 --sout='#transcode{vcodec=h264,vb=2048,acodec=mp3,ab=192,deinterlace}:standard{mux=ts,access=file{no-overwrite},dst=/Users/me/Pictures/video.ts}' --run-time=10 --play-and-exit >> /tmp/log.txt 2>&1

But in result log.txt contains the following text -

[00000001002300c8] [cli] lua interface: Listening on host "*console".
VLC media player 2.2.0 Weatherwax
Command Line Interface initialized. Type `help' for help.
> Shutting down.
[00000001002300c8] [cli] lua interface: Requested shutdown.

and empty (0 bytes) video.ts.

What is wrong here?

5
  • 1
    Does it work as expected if you run the command directly in the shell?
    – nohillside
    Commented Oct 24, 2016 at 20:06
  • How do you know that the source you are using is actually "live?" The last line says that it closed based on user request "play-and-exit"
    – Allan
    Commented Oct 24, 2016 at 20:36
  • @patrix, yes, it works correctly.
    – LA_
    Commented Oct 24, 2016 at 20:47
  • @Allan, the source works well if I open in VLC GUI. Or if I run the command manually in the shell. I tried to remove play-and-exit, but result is the same.
    – LA_
    Commented Oct 24, 2016 at 20:54
  • I had tons of issues with VLC recording live streams. I since switched to ffmpeg and I no longer have the issue. I referenced it in another question. Also, it's a better idea to not have cron run the job directly - write a bash script for it.
    – Allan
    Commented Oct 24, 2016 at 21:37

2 Answers 2

1

You're using the rc (remote control) interface, which expects input on the command line - i.e., expects and interactive session.

From cron try the dummy interface:

0/5 * * * * /Applications/VLC.app/Contents/MacOS/VLC -I dummy rtp://@xxx.xxx.xxx.xxx:5050 --sout='#transcode{vcodec=h264,vb=2048,acodec=mp3,ab=192,deinterlace}:standard{mux=ts,access=file{no-overwrite},dst=/Users/me/Pictures/video.ts}' --run-time=10 --play-and-exit >> /tmp/log.txt 2>&1
0

Seems like cron doesn't set the environment variables the same way when executing as when you would in a standard shell or from a shell script. Take a look at the manpages for cron and see if there's something else that needs to be modified in the crontab or added to the beginning of the script itself. For example, you can declare at the beginning of the script: SHELL=/bin/sh to make sure it's executing with the right shell.

You must log in to answer this question.

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