Page 1 of 1

mencoder & cron problem

Posted: Thu Jun 17, 2010 2:25 pm
by ^rooker
[PROBLEM]
I wanted to convert videos periodically, using mencoder and crontab. The script itself was working properly, and I've tested the exact command for mencoder with all its arguments manually - several times - but when the script was run by cron, mencoder gave me the following output:

Code: Select all

==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffv1] vfm: ffmpeg (FFV1 (lossless codec))
==========================================================================                                                                                                                                                                                                                  Flushing video frames.
Writing Index...
Overhead: nan% (0 / 0)
Writing header...
Video stream:      nan kbit/s  (-2147483648 B/s)  size: 0 bytes  0.000 secs  0 frames
Audio stream:      nan kbit/s  (-2147483648 B/s)  size: 0 bytes  0.000 secs
It was actually reading the right file, displaying the codec information and then bails out with invalid values (nan = Not A Number), size 0 bytes, etc... which usually looks like what you get when you point things at nonexistent or broken files. weird...

[SOLUTION]
Thanks to a short blog entry by Debjit at 'gpledmind' about problems with cron and mplayer, I've tried adding the following line to my crontab:

Code: Select all

MAILTO=""
No shit! It worked. That was actually it!

(I'm not really sure, but maybe it's got something to do with "in which pipe does mencoder write which output", because I've also had problems calling it directly from PHP with "proc_open()" and pipes. It only worked when called by "passthru()" - but that's just a fair guess)