public function process(MediaFile $file) { $audioPath = $file->getAudioPath(); $videoPath = $file->getVideoPath(); $processedPath = DownloadManager::createPath($videoPath, 'mp4'); $result = self::run(sprintf('ffmpeg -itsoffset %f -i %s -i %s -strict -2 %s -c:v libx264 -preset ultrafast -crf 23 -y', (double) $file->getAudioDelay(), Data::getUploadPath() . '/' . $audioPath, Data::getUploadPath() . '/' . $videoPath, Data::getUploadPath() . '/' . $processedPath)); if ($file->getProcessedPath() != null) { $file->delete($file->getProcessedPath()); } $file->setProcessedPath($processedPath); $this->em->flush(); return $result; }
public function lifecycleFileUpload() { if ($this->getAudioFile()) { $this->delete($this->getAudioPath()); $path = DownloadManager::createPath($this->getAudioFile()->getClientOriginalName()); $this->getAudioFile()->move(Data::getUploadPath(), $path); $this->setAudioPath($path); } if ($this->getVideoFile()) { $this->delete($this->getVideoPath()); $path = DownloadManager::createPath($this->getVideoFile()->getClientOriginalName()); $this->getVideoFile()->move(Data::getUploadPath(), $path); $this->setVideoPath($path); } }