I want to create a website that plays videos uploaded by the users in html5 video.
How can I convert any video type on server side to WebM, OGG or MP4?
Is FFmpeg
Yes, ffmpeg is the best solution, but you need to follow the next steps to make video working in all browsers:
1- Download the last version of ffmpeg from here ffmpeg download
2- Extract the content to a directory;
3- With PHP call the exe file to generate the mp4 and webm video format, like this:
exec(ffmpegdirectory/bin/ffmpeg.exe -i your_video_path -qscale 4 -vcodec libx264 -f mp4 your_new_video_path.mp4);
exec(ffmpegdirectory/bin/ffmpeg.exe -i your_video_path -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 -s your_new_video_path.webm);
4- Allow in IIS(if it is your case) the Mime Types mp4 and webm
5- Use video.js to build the html5 video tag and call your two converted videos (mp4 and webm);
Note: if you don't use video.js, probably the video won't work in IE.