Dave Dave - 1 year ago 199
PHP Question

FFmpeg on Windows - Background converting

I'm having real trouble in getting FFMPEG to convert in the background *Note that when I upload videos and through php the convert works but just sits there and I'm unable to navigate around my website until its finished.

I don't run Linux and don't really have intentions of doing so. And I have windows 7 so unable to use the dev/null/ &. I did try that after reading the very few tutorials online, most of which are outdated due to the depreciated FFmpeg-php and it did absolutely nothing.

The bit of code that I currently have to convert is as follows!

shell_exec("$ffmpeg -i ".$folder.$final_file." ".$destination_mp4." ");

so my question would be. What are the right commands to allow a windows user to convert in php within the background successfully, whilst the video converts?


I use this to run scripts in the background without waiting for them to finish:

$cmd = "$ffmpeg -i ".$folder.$final_file." ".$destination_md4." ";
pclose(popen("start /B $cmd", 'r'));

I've also seen this suggested as a way to run background processes in Windows:

$WshShell = new COM("WScript.Shell");
$WshShell->Run($cmd, 0, false);