Amazon has a service for transcoding video. https://aws.amazon.com/elastictranscoder/?nc1=h_l2_as and the AWS SDK has a PHP client for it.
Other option is (assuming you are using a Linux server) is to use ffmpeg and the PHP classes for it to do the transcoding. Of course, you'll want to use some sort of worker/message queue to perform the actual transcoding into the final format(s) you need for smartphones. Oh, and ensure that all the right codecs are installed for ffmpeg to work.