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

  • SEARCH
  • Home
  • 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 6632027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:37:43+00:00 2026-05-25T22:37:43+00:00

I have my upload script that handles the file upload and then calls exec(ffmpeg

  • 0

I have my upload script that handles the file upload and then calls exec(ffmpeg -i……

I call ffmpeg 3 times. One to convert to mp4, one to convert to wemb and one to get thumbnail.

Problem is that if an investigator uploads ALL his footage, he doesnt want to have to sit there and wait for it to convert before he can do anything else. So how can i send the 3 commands and then exit the script?

I also want to run exec(rm -r /path/to/original) so the original video is deleted but obviously I have to wait for conversions to be complete before it can be run

  • 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-05-25T22:37:43+00:00Added an answer on May 25, 2026 at 10:37 pm

    You can use the ampersand character after the command to run it in the background and get your prompt (control) back right away.

    I suggest creating a bash script like:

    #!/bin/sh
    ffmpeg -i $1 -ab 64k -vb 420k $1.mp4
    ffmpeg -i $1 -ab 64k -vb 420k $1.webm
    

    Then run it from php like:

    system ('myscript.sh tempfile &');
    

    The following example uses if structure to decide whether to use sound or no. The first parameter is the filename, if the second one equals 0 then no sound on the mp4, if the third one is zero then no sound on the webm.

    #!/bin/sh
    if [ $2 -eq 0 ]
    then
        ffmpeg -i $1 -an -vb 420k $1.mp4
    else
        ffmpeg -i $1 -ab 64k -vb 420k $1.mp4
    fi
    
    
    if [ $3 -eq 0 ]
    then
        ffmpeg -i $1 -an -vb 420k $1.webm
    else
        ffmpeg -i $1 -ab 64k -vb 420k $1.webm
    fi
    

    You can use it from PHP like:

    system ('myscript.sh ' . $tempfile . ' ' . (0 + $mp4sound) . ' ' . (0 + $webmsound) . ' &');
    

    … but remember you can even start a PHP file instead of a shellscript like:

    system ("php converter.php \"$tempfile\" \"$mp4sound\" \"$webmsound\" &');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question. I have a script that handles file upload, and after
I have an upload script that write a index.html file, I modified it to
1.Hi, I have a internal use only file upload script that uploads the files
I have written a pretty basic upload script that takes the file and uploads
I have a PHP script that processes file uploads. The script tries to organise
So I have an upload script, and I want to check the file type
BACKGROUND I have a script to upload an image. One to keep the original
I have a standard file upload script using this script. When the upload is
I have an upload system based on SWFUpload which calls PHP script. The problem
I have an Send.aspx page that has an uploadify control on it. Upload.ashx handles

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.