I am trying to accomplish something similar to YouTube player. The biggest issue I'm facing now is how should I process user uploaded video files.
For example, since I want to switch between 240p, 360p, 480p and 720p I need to convert each uploaded video file to 4 different files for each resolution, and because not all browsers can play .mp4 I need .ogg, .mp4, .webm, so that makes 12 video files. If it takes 10 minutes to process 1h video file it would take me about 2h just to process that file which is insane. I know that YouTube uses cloud servers to process each video file and has a lot of processing power but I think there must be some kind of trick to this.
So my question is what can I do about this and how does YouTube deal with this?
My second question is, is FFmpeg suited for this kind of work, and if so why does this command take pretty much for ever to finish? I ran this command on a 720p 3 minutes long video file and after 15 minutes of processing I just canceled the process.
ffmpeg -i hd.webm a.mp4
This one on the other hand took about 7 minutes to finish but it generated 200mb video file out of 25mb file:
ffmpeg -i hd.webm -c:v libx264 -preset ultrafast a.mp4