OS: ubuntu 11.10 Webserver: Apache Code: PHP I'm attempting to display the creation of command "ffmpeg -i " around the web page using php. Needed: The web page should show the data about video (text). What is happening: The web page shows no text output on running the php code. Basically was however doing system("ls") the code runs fine and results their email list of files. Here's my code

 echo "Details of video file:";
 system('ffmpeg -i /home/atish/Videos/T2V0040006_Angled_ride_720x576i_FLDCMB.avi');

Exactly the same command works fine on my small spend, and my system has ffmpeg installed. Here is a snapshot of performing this command on spend:

ThinkPad-T420:~/Videos$ ffmpeg -i /home/xx/Videos/T2V0040006_Angled_ride_720x576i_FLDCMB.avi
ffmpeg version git-2012-01-10-7e2ba2d Copyright (c) 2000-2012 the FFmpeg developers
built on Jan 10 2012 12:01:19 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-    amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
  libavutil      51. 34.100 / 51. 34.100
  libavcodec     53. 54.100 / 53. 54.100
  libavformat    53. 29.100 / 53. 29.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 58.100 /  2. 58.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    51.  2.100 / 51.  2.100
  Input #0, avi, from '/home/atish/Videos/T2V0040006_Angled_ride_720x576i_FLDCMB.avi':
  encoder         : Lavf52.23.1
  Duration: 00:00:29.00, start: 0.000000, bitrate: 124422 kb/s
  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576, 25 tbr, 25 tbn, 25 tbc
  At least one output file must be specified

I've attempted appending "DISPLAY=:" to my command as well as done "xhost +" before you run php code, but there is nothing helping me out.


You should utilize exec rather, and pass an output parameter like so

$op = array();
exec('ffmpeg -i /home/atish/Videos/T2V0040006_Angled_ride_720x576i_FLDCMB.avi', $op)

REF: http://php.net/manual/en/function.exec.php

Perhaps you have attempted professional() rather than system()? See here for any discussion of difficulties with PHP and ffmpeg in addition to a method that utilizes proc_open().

This link describes the why and how. Just replies folks.

This is one way to obtain the preferred output:

echo exec('/usr/local/bin/ffmpeg -i input.mp4 2>&1', $output);