Jump to content

running a exec() from php


denoteone

Recommended Posts

Trying to convert an avi into a flv using a phpscript and ffmpeg. Below is the most important part of my code but I am not able to convert yet.

 

$newname = myvideo.avi
  
define('FFMPEG_LIBRARY', '/usr/bin/ffmpeg ');

$exec_string = FFMPEG_LIBRARY.' -i /var/www/html/site/videos/day/upload/$newname  /var/www/html/site/videos/day/upload/outputfile.flv';

exec($exec_string); 

 

I have a video portal running so I am sure that I have ffmpeg installed correctly.

 

Any help would be great.

Link to comment
https://forums.phpfreaks.com/topic/197887-running-a-exec-from-php/
Share on other sites

caught one of my own mistakes in the $exec_string variable.

 

		  define('FFMPEG_LIBRARY', '/usr/bin/ffmpeg ');

	  $exec_string = FFMPEG_LIBRARY.' -i '. $newname .' -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv';

	   echo $exec_string;

	  exec($exec_string);

 

But still not working.

I had a similar problem when calling mysqldump via the exec command last week. My problem was wrapping all variables in single quotes. If your variable content (ie. the new filename) has a space in it, the command would be parsed incorrectly. Have you tried running the command directly via the Terminal? If so, what error did you get?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.