phpfile-uploadmp4movvideo-conversion

How can I convert a movie into .MP4 from .MOV using a PHP upload script?


I am trying to upload a movie onto a site and then automatically convert it into .mp4 format from the .mov iPhone format. Is there a php conversion library or tool that would help me do this?

Thanks.


Solution

  • Not really unfortunately.

    I've been doing this exact thing for the past 4 years, if you want to take a crack at writing it yourself, your best bet is to fork an exec to ffmpeg in your upload script eg.

    exec('ffmpeg ... &');
    

    note the ampersand at the end, this allows your php script to complete while allowing the encode to happen in the background, also CHECK YOUR INPUT VARS as there is the chance of shell injection using this method.

    or the alternative:

    use a system like beanstalkd as a message queue between your php upload script and a worker process (I use a custom multithreaded perl script) on the backend that takes in new encodes and processes them (I'm using ffmpeg, mencoder, or quicktime using qt_tools, depending on input video format), using memcached as temp storage for encoding status.

    sorry I can't be more specific right now, I may update this tomorrow with a bit more, but I've been up all night, and need SLEEP. hopefully this gets you moving in the right direction till then.