Php 在这段代码中ffmpeg命令是如何执行的

Php 在这段代码中ffmpeg命令是如何执行的,php,ffmpeg,Php,Ffmpeg,想知道在这段代码中如何执行ffmpeg命令来截图。我无法确定屏幕截图是什么时候创建的,由哪个函数或由哪一行完成的 $ffmpeg = '/usr/bin/ffmpeg'; $video = $sourceUrl;// the input video file $thumbId = uniqid(); $thumbId .= ".jpg"; // where you'll save the image $imag

想知道在这段代码中如何执行ffmpeg命令来截图。我无法确定屏幕截图是什么时候创建的,由哪个函数或由哪一行完成的

  $ffmpeg = '/usr/bin/ffmpeg';
        $video  = $sourceUrl;// the input video file
        $thumbId = uniqid();
        $thumbId .= ".jpg";
        // where you'll save the image
        $image = "uploads/$thumbId";
        // default time to get the image
        $second = 1;
        // get the duration and a random place within that
        $cmd = "$ffmpeg -i $video 2>&1";
        if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
            $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
            $second = rand(1, ($total - 1));
        }

        // get the screenshot
        $cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -s 120x90 -vcodec mjpeg -f mjpeg $image 2>&1";
        $return = `$cmd`;
        $thumbLink = "";

此行执行存储在变量
$cmd
中的命令:

    $return = `$cmd`;

在PHP中,backtick是,其用法与调用相同。

@Dan感谢编辑,希望编写正确的拼写。