Here is my code.. I have tried mutlitple things trying to find out how to combine this command into. I have looked about 5 hours trying to find this out but no such luck.. $cmd = sprintf('ffmpeg -t 3 -ss 00:00:02 -i %s %s',$file_location,$file_name_output); exec($cmd); $file_name_output_done=$number.'_'.$file_name_edited.'.gif'; $cmd2 = sprintf('convert %s -resize 320x240 %s',$file_name_output,$file_name_output_done); exec($cmd2); $cmd3=sprintf('convert -font Arial -fill orange -pointsize 50 -gravity north -draw "text 0,30 \"Click Play\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done); exec($cmd3); $cmd4=sprintf('convert -font Arial -fill orange -pointsize 16 -gravity south -draw "text 0,40 \"CLICK PLAY VIDEO\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done); exec($cmd4); PHP: So I have all this above.. How can I combine this into one command? I tried to combine 2 alone and it didn't work then I tried other things and still no luck... Stuff I tried combined 3 & 4 $cmd3=sprintf('convert -font Arial -fill orange -pointsize 50 -gravity north -draw "text 0,30 \"Click Play\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done,'convert -font Arial -fill orange -pointsize 16 -gravity south -draw "text 0,40 \"CLICK PLAY FOR COMPLETE VIDEO\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done); exec($cmd3); PHP: //then I tried this but the text only shows up in part of the video.... $cmd3=sprintf('convert -font Arial -fill orange -pointsize 50 -gravity north -draw "text 0,30 \"Click Play\"" -gravity Center %s %s convert -font Arial -fill orange -pointsize 16 -gravity south -draw "text 0,40 \"CLICK PLAY FOR COMPLETE VIDEO\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done,$file_name_output_done,$file_name_output_done); exec($cmd3); PHP:
You may create a shell script files using all your command. Adding +X permission. Running it using exec or shell_exec and then delete the script file once the work is done.
Add a semicolon between any two lines. E.g. exec ('cd /'); exec ('cd /home'); is the same as exec ('cd /; cd /home');
$cmd_full=$cmd.'; '.$cmd2.'; '.$cmd3.'; '.$cmd4; exec($cmd_full); ---------------------- also tried - exec($cmd,$cmd2,$cmd3,$cmd4); this did not work...
log the outputs to see what's wrong exec ($cmd_full . ' 1>/path/to/log 2>/path/to/log'); then analyze /path/to/log
I get a php error. Not command error. I am using a sprintf which it doesn't seem to like in that case... Im not sure what else to do. Not unless I can input the values in a different way through php without using a sprintf
what was that PHP error? Does $file_name_output_done contain any space characters, commas, apostrophes etc?
No its just a number for example first part 3 second part 4_44 third part a. for example from above - $cmd = sprintf('ffmpeg -t 3 -ss 00:00:02 -i %s %s',$file_location,$file_name_output); exec($cmd); $file_name_output_done=$number.'_'.$file_name_edited.'.gif'; $cmd2 = sprintf('convert %s -resize 320x240 %s',$file_name_output,$file_name_output_done); exec($cmd2); $cmd3=sprintf('convert -font Arial -fill orange -pointsize 50 -gravity north -draw "text 0,30 \"Click Play\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done); exec($cmd3); $cmd4=sprintf('convert -font Arial -fill orange -pointsize 16 -gravity south -draw "text 0,40 \"CLICK PLAY VIDEO\"" -gravity Center %s %s',$file_name_output_done,$file_name_output_done); exec($cmd4); PHP:
Well, what's this error? try without sprintf then. $cmd = 'ffmpeg -t 3 -ss 00:00:02 -i ' . $file_location . ' ' . $file_name_output; PHP:
I think that may work as silly as that sounds.. haha thanks I will try that. (i did try something like that but I believe my quotes and periods may have been in the wrong spot.