0

I have ffmpeg installed on a CentOS 7 machine running a standard LAMP stack. I can run ffmpeg fine by itself in a terminal, like so:

ffmpeg -i "rtsp://admin:password@10.0.0.152/play2.sdp" camera1.mp4

I have a php script more or less like the following:

<?php
$camerabash = shell_exec('ffmpeg -i "rtsp://admin:password@10.0.0.152/play2.sdp" camera1.mp4');
echo $camerabash;
?>

The following gives me an echoed result of "apache":

<?php
$camerabash = shell_exec('whoami');
echo $camerabash;
?>

I think I have a permissions problem, and I've explored a few options including editing the http.conf file, nothing seems to work.

Dustin
  • 1
  • 1
  • Check the audit log. – Michael Hampton Feb 03 '21 at 18:18
  • httpd error log is as follows: title : Session streamed by D-Link comment : play2.sdp Stream #1:0: Video: h264, yuv420p, 640x352, q=2-31, 15.08 tbr, 90k tbn, 90k tbc Stream #1:1: Audio: aac, 16000 Hz, mono Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Stream #0:0 -> #1:0 (copy) Stream #0:1 -> #1:1 (copy) Could not write header for output file #0 (incorrect codec parameters ?): Permission denied – Dustin Feb 03 '21 at 18:22
  • You may add the 2>&1 at the end of the command to catch errors – Dom Feb 03 '21 at 18:23
  • So Apache can't write in camera1.mp4 file. You can try "touch ('camera1.mp4');" to see if it works – Dom Feb 03 '21 at 18:29
  • Last line or error returned reads as follows: camera1.mp4: Permission denied – Dustin Feb 03 '21 at 18:29
  • OK, now check the audit log. – Michael Hampton Feb 03 '21 at 19:06

0 Answers0