1, 'msg' => $config['error']['genwebmerror']); if ($ffprobe_out['format']['format_name'] != 'matroska,webm') return array('code' => 2, 'msg' => $config['error']['invalidwebm']); if ((count($ffprobe_out['streams']) > 1) && (!$config['webm']['allow_audio'])) return array('code' => 3, 'msg' => $config['error']['webmhasaudio']); if ($ffprobe_out['streams'][0]['codec_name'] != 'vp8') return array('code' => 2, 'msg' => $config['error']['invalidwebm']); if (empty($ffprobe_out['streams'][0]['width']) || (empty($ffprobe_out['streams'][0]['height']))) return array('code' => 2, 'msg' => $config['error']['invalidwebm']); if ($ffprobe_out['format']['duration'] > $config['webm']['max_length']) return array('code' => 4, 'msg' => $config['error']['webmtoolong']); } function make_webm_thumbnail($filename, $thumbnail, $width, $height) { global $board, $config; $filename = escapeshellarg($filename); $thumbnail = escapeshellarg($thumbnail); // Should be safe by default but you // can never be too safe. $ffmpeg = $config['webm']['ffmpeg_path']; $ffmpeg_out = array(); exec("$ffmpeg -i $filename -v quiet -ss 00:00:00 -an -vframes 1 -f mjpeg -vf scale=$width:$height $thumbnail 2>&1"); return count($ffmpeg_out); }