Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:48:57+00:00 2026-06-17T08:48:57+00:00

This is more an operating systems question than a PHP question, but here it

  • 0

This is more an operating systems question than a PHP question, but here it is regardless:

I’m looking to run ffmpeg via shell_exec() to convert uploaded videos to different formats. I’m wondering how the OS handles multiple ffmpeg commands when multiple videos are uploaded.

Here is some example code to make it more explicit:

<?php

  $filePath = upload($_FILE['video']); //get filepath from uploaded file

  shell_exec('ffmpeg ' . $filePath . ' video.mp4'); //simple ffmpeg conversion

?>

Assume the OS is linux-based.

  • Will the OS create a thread for each command until it runs out of memory using the code above?
  • I’m assuming that creating some sort of queue is a better way of handling these calls, but does that mean the system will only be converting one video at a time?
  • What if I wanted the system to be converting multiple videos in parallel, and what is a good way of knowing the max number of parallel threads a system can handle before it becomes overburdened?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:48:58+00:00Added an answer on June 17, 2026 at 8:48 am

    PHP will fork off a separate process for every individual shell_exec command that is executed.

    Queuing these jobs up would be a good idea. So would running them in the background, rather than delaying the response from PHP until both the upload and the ffmpeg job are done. PHP does not have any built-in way to do this, but there are a number of libraries, like Gearman, for managing tasks like this.

    For CPU-bound jobs like video conversion, a good rule of thumb is one process per physical CPU core.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probally more of an elegance question than functionality. I am looking for
I know this is more heavy question, but I think its interesting too. It
Ok, I'm going to try to make this more clear because my last question
This is more of a design question. I have a template class, and I
This is more of a hypothetical question. I am wondering if anyone knows if/how
For the sake of this question, let efficiency mean, more-or-less, page rendering speed. Albeit,
I have written a question on here before with similar issues, but i have
This is an academic question (I'm not necessarily planning on doing it) but I
This is quite simple question but I didn't find an answer: Is there any
No I didn't reverse my operating systems in that question! My background has been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.