开发者

ffmpeg php convert in background

Hier is the deal: I converted my file with next command:

$output = exec("ffmpeg -i ".$directory_path_full." -ar 22050 -ab 32 -f flv -s 320x240 ".$directory_path.$file_name.".flv");

But now I need to tell database that processing is over! how to do that? if converting is done, insert into database tabl开发者_如何转开发e videos row converted to 1.

also found this script: $output = shell_exec('ffmpeg ' . escapeshellarg($directory_path_full) . ' ' . escapeshellarg($directory_path.$file_name.".flv"));

and again how to update database that completed?


exec() will not return until whatever you're executing completes, so basically:

exec("ffmpeg blah blah blah", $output, $return_var);

if ($return_val = "whatever value indicates success") {
    ... update database to indicate success ...
}

Don't assume the conversion succeeded and blindly update the database, always check if things actually succeeded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜