function encodeMedia($dirname, $basename) { $srcFile = getFtpMediasRoot() . $dirname . '/' . $basename; $dstFileDirname = getHttpMediasRoot() . $dirname . '/flv/'; $dstFileBasename = preg_replace('/\\.(wmv|mpg|mp4)$/i', '.flv', $basename); $dstFile = $dstFileDirname . $dstFileBasename; $commandLine = sprintf('ffmpeg -i "%s" -ar 44100 -ab 128k -b 1024k -s 740*416 -y -f flv "%s"', $srcFile, $dstFile); exec($commandLine, $output); if (file_exists($dstFile)) { return array(str_replace(getHttpMediasRoot(), '', $dstFileDirname), $dstFileBasename); } else { return false; } }
public function getMediaWidth() { $this->ffmpeg_movie_object = new ffmpeg_movie(getHttpMediasRoot() . $this->fullPath); return $this->ffmpeg_movie_object->getFrameWidth(); }
/** * deleteMediaEntry function. * Supprimer une entrée média de la base * * @access public * @param mixed $id_media * @return void */ public function deleteMediaEntry($id_media) { $mediaFlvPath = $this->query(sprintf('SELECT CONCAT(dirname,"/",basename) FROM medias WHERE id_media=%s', $id_media))->fetchColumn(); @unlink(getHttpMediasRoot() . $mediaFlvPath); $delete = sprintf("DELETE a.*, m.*, maa.* FROM medias m\n \t\t\t LEFT JOIN medias_acces a USING(id_media)\n \t\t\t LEFT JOIN medias_acces_avions maa USING(id_media)\n \t\t\t WHERE id_media=%d", $id_media); if ($this->exec($delete) === false) { throw new Exception("Erreur lors de la désactivation du média.<br />Requête:<br />{$delete}"); } return $delete; }