You need a video editing program like FFmpeg installed on your server and your php enabled with function exec.There is a ffmpeg-php API on github. Do some search, you might find out similar classes too.