Jump to content

FFMPEG exec() commands


chrisc0015

Recommended Posts

Hi,

 

I'm relatively new to PHP and am creating a website which will take uploaded files and convert them to FLV files for quick viewing using an FLV player.  It is similar to YouTube.

 

After a successful upload I hope to first convert the video file to FLV, and then create a thumbnail from the FLV file.

 

In my upload script, the two commands follow eachother:

 

exec("Video to FLV Conversion");

exec("Thumbnail creation");

 

The video converts always, and on very small videos (below 500k) the thumbnail creation works as well... but for larger files, the thumbnail creation does not execute.  But if I run only the "exec('Thumbnail creation');" after the FLV has already been converted, it creates the thumbnail.

 

My thoughts are that the Thumbnail exec() starts before the FLV Conversion exec() is completed.  Is there a way to ensure the first exec() finishes before continuing through the script?  I could also try merely taking the thumbnail from the initial video file (non-FLV) and it may work fine... but I thought I'd ask here first as I've read some complications creating thumbnails from several types of video files.

 

Any help is appreciated, thanks.

Link to comment
Share on other sites

My thoughts are that the Thumbnail exec() starts before the FLV Conversion exec() is completed.

 

That is not the case. Only one function can be executed at a time in php, the second exec call can obnly begin after the first is complete.

 

My theory is that your server is timing out. running commands like that probably isn't too wise within a web environment unless you have a dedicated server, and even then, your clients will be left waiting for the conversion.

 

You'd be best to look into ways of letting this all happen in the background.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.