Пример #1
0
 $fps = validInteger(getset('fps', ceil($event['Frames'] / $event['Length'])));
 $vcodec = validString(getset('vcodec', ZM_EYEZM_EVENT_VCODEC));
 $baseURL = ZM_PATH_WEB . "/" . getEventPathSafe($event);
 /* Here we validate the codec.
  * Check that FFMPEG exists and supports codecs */
 if (!strcmp($vcodec, "mpeg4")) {
     if (!ffmpegSupportsCodec("mpeg4")) {
         logXmlErr("FFMPEG not installed, accessible in path/ZM_PATH_FFMPEG, or doesn't support mpeg4");
         exit;
     }
     /* Can generate, we are good to go */
     $fname = "capture.mov";
     $ffparms = "-vcodec mpeg4 -r " . ZM_EYEZM_EVENT_FPS . " " . $baseURL . "/" . $fname . " 2> /dev/null";
 } else {
     if (!strcmp($vcodec, "h264")) {
         if (!ffmpegSupportsCodec("libx264")) {
             logXmlErr("FFMPEG not installed, accessible in path/ZM_PATH_FFMPEG, or doesn't support H264");
             exit;
         }
         if (!requireVer("1", "2")) {
             logXmlErr("H264 Event viewing requires eyeZm v1.2 or greater");
             exit;
         }
         /* Good to go */
         $fname = "capture.mp4";
         $ffparms = getFfmpeg264FoutParms(validString(getset('br', ZM_EYEZM_H264_DEFAULT_EVBR)), $baseURL . "/" . $fname);
     } else {
         logXmlErr("Unknown codec " . $vcodec . " selected for event viewing");
         exit;
     }
 }
Пример #2
0
/** Returns whether necessary components for H264 streaming
 * are present */
function canStream264($sup = 0)
{
    if (!ffmpegSupportsCodec("libx264")) {
        if (!$sup) {
            logXmlErr("FFMPEG not installed, accessible in path/ZM_PATH_FFMPEG, or doesn't support libx264");
        }
        return FALSE;
    }
    /* Make sure segmenter exists */
    if (!exeExists(shell_exec("which segmenter"))) {
        if (!$sup) {
            logXmlErr("HTTP segmenter not installed or not accessible in path");
        }
        return FALSE;
    }
    /* Check for zmstreamer */
    if (!exeExists(shell_exec("which zmstreamer"))) {
        if (!$sup) {
            logXmlErr("ZMSTREAMER not installed or not accessible in path");
        }
        return FALSE;
    }
    return TRUE;
}