开发者

Start ffmpeg transcoding with php

Hey there! I want to restart a live stream by hand via a php script. Everything works fine so far, but the following command causes that the script loads forever and the transcoding isn't working:

nohup openRTSP开发者_如何转开发 -v -c rtsp://*****.dyndns.org:665 | ffmpeg -r 5 -f mjpeg -i - http://127.0.0.1:8090/feed1.ffm > /dev/null &

Any ideas how to start that command e.g. without waiting for the output?


Not that it will necessarily solve your problem, but it should answer your question, found in the PHP comments under "exec" in which several people came across similar situations.

I combined several efforts in this topic into one function: This will execute $cmd in the background (no cmd window) without PHP waiting for it to finish, on both Windows and Unix.

function execInBackground($cmd) { 
    if (substr(php_uname(), 0, 7) == "Windows"){ 
        pclose(popen("start /B ". $cmd, "r"));  
    } 
    else { 
        exec($cmd . " > /dev/null &");   
    } 
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜