/** * Prepares all necessary data for converting video file and calls "executeConversion" method * * @param File $videoEntity * @param string $newExtension * @param int $bitrate * @return File */ public function convertVideo(File $videoEntity, $newExtension = self::MP4_EXT, $bitrate = 300) { //With libav avconv installed $oldLocation = $videoEntity->getLocation(); $videoEntity->setExtension($newExtension); $this->sm->get('doctrine.entitymanager.orm_default')->persist($videoEntity); $this->sm->get('doctrine.entitymanager.orm_default')->flush(); $newLocation = $videoEntity->getLocation(); $this->executeConversion($oldLocation, $newLocation, $bitrate); return $videoEntity; }
/** * Prepares all necessary data for converting audio file and calls "executeConversion" method * * @param File $audioEntity * @param string $newExtension * @return File */ public function convertAudio(File $audioEntity, $newExtension = self::MP3_EXT) { //With libav avconv installed $oldLocation = $audioEntity->getLocation(); $audioEntity->setExtension($newExtension); $this->sm->get('doctrine.entitymanager.orm_default')->persist($audioEntity); $this->sm->get('doctrine.entitymanager.orm_default')->flush(); $newLocation = $audioEntity->getLocation(); $this->executeConversion($oldLocation, $newLocation); return $audioEntity; }