Video Transcoding Solution on Shared Webhosting Server

I spent a lot of time trying to debug why video files were not uploading successfully to my UNA site. The video transcoding with ffmpeg was repeatedly failing.

Now that I have fixed the problem, I hope that my discovery will help others:

The issue was with my shared webhosting server which protects against "abuse of resources" (video transcoding is considered processor intensive). It won't allow installation of ffmpeg on the server, but it's okay because UNA provides a static build in ~/plugins/ffmpeg which does run. However when it came to video transcoding it was blocked by the server environment. Now I know that it was triggered by ffmpeg using too many threads.

The solution was to limit the number of threads (I'm using 1; when I have time I can explore how many hits the maximum allowed) when calling the ffmpeg command. In CLI this would be "ffmpeg -y -threads 1 -i "...etc... To configure my UNA solution to use only 1 thread with ffmpeg I added the following to ~/inc/header.inc.php :

define('BX_SYSTEM_FFMPEG_THREAD', '1'); ///< limit video transcoding thread number for shared webhosting limits.

  • 1230
  • More
Replies (2)
    • Hello @phetisch

      Thank you for sharing the info 👍

      • So clever. So ingenius. You should receive college credit for coming up with it. A lot of college credit, I might add.

        Much thanks for sharing your solution. We have been trying to figure this out for quite a while. It's come up over and over. One frustrated user after another being advised to get a vps or dedicated server.

        Could you tell us more about your shared plan as far as RAM and processor cores. Also, what is the biggest video you have been able to upload with this single thread limit setting?

        Oh my, can you believe all the settings for FFMPEG? Front end users have no idea how complicated it is and what is going on behind the scenes...

        Please keep us informed right here as you continue to experiment.

        Login or Join to comment.