The Mission: Drop video (mov, wmv, avi, etc.) files (via ssh) onto a computer on our network, have them automatically converted to ipod format using the command: ffmpeg -i "0098273.wmv" -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ar 44100 -ab 160 -s 320x240 -aspect 4:3 0098273.mp4
So Far: I can get a list of current files in the directory into a text file, have php read the list, and generate the above command with the correct file names for input and output (0098273 in this example). Issuing the above command from a ssh shell works fine.
What I Need Help With: I'm not experienced using php to execute programs on the server, so I don't know how to use exec() or shell_exec(). Would either of these be appropriate to call ffmpeg with the switches above?
What The Program Should Look Like: Ideally, I would like to drop a file/multiple files into a directory on the server, have php recognize it (just using a cron job every few minutes), execute ffmpeg, and when finished, delete the original file 0098273.wmv and move the converted file 0098273.mp4 to a different directory with all the other ipod converted videos.
Specific Questions:
Do you recommend exec() or shell_exec() or something else?
Is there a way for php to know when ffmpeg is finished encoding so the script does not try to run multiple instances of the ffmpeg?
Which functions can delete/move files?
If you've made it this far, I sincerely thank you for taking your time to read this. I am not asking for someone to write this program for me
-Chris