• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

ffmpeg file conversion.

suasive

Active member
#1
I have a PHP File uploader, like this one

Every time I upload a file it gives me this error.

I've tried this set of code,
PHP:
<?php
    echo "Starting ffmpeg...\n\n";
    echo shell_exec("ffmpeg -y -i input.avi output.avi </dev/null >/dev/null 2>/var/log/ffmpeg.log &");
    echo "Done.\n";
?>
But it isn't working.
I'm trying to get the server to convert the video in the background
I would love to develop something for this, any help would be much appreciated.
Ps: I already have ffmpeg install on the server
 
Last edited:

WSWD

Well-known member
#2
What is the ffmpeg error? It's not a PHP error, and "Could not convert video file" is not useful in the slightest.
 

Jim Boy

Well-known member
#3
why in the background? Does it need to be very speedy? Could you take a different approach, eg save the file to disk and let a cronjob take of it? Or better still, use inotify.
 

WSWD

Well-known member
#5
I could, but I wouldn't know where to start from there.
You can safely ignore that. There is absolutely nothing wrong with running it in the background like you're trying to do. I do something very similar with video on one of the sites I run.

The PHP code appears to be just fine. Something odd is obviously happening during the conversion process. You're going to want to start in SSH and troubleshoot the actual ffmpeg commands, to see where the error is occuring snd why.