/** * */ public function convert() { $this->save(); $cmd = Pimcore_Tool_Console::getPhpCli() . " " . PIMCORE_PATH . DIRECTORY_SEPARATOR . "cli" . DIRECTORY_SEPARATOR . "video-converter.php " . $this->getProcessId(); Pimcore_Tool_Console::execInBackground($cmd); }
/** * @param $path * @return Pimcore_Video_Adapter */ public function save() { if ($this->getDestinationFile()) { if (is_file($this->getConversionLogFile())) { @unlink($this->getConversionLogFile()); } if (is_file($this->getDestinationFile())) { @unlink($this->getDestinationFile()); } // get the argument string from the configurations $arguments = implode(" ", $this->arguments); // add format specific arguments /*if($this->getFormat() == "f4v") { $arguments = "-f flv -vcodec libx264 -acodec libfaac -ar 44000 -g 100 " . $arguments; } else*/ if ($this->getFormat() == "mp4") { // `-coder 0 -bf 0 -flags2 -wpred-dct8x8 -wpredp 0´ is the same as to -vpre baseline, using this to avid problems with missing preset files //$arguments = "-strict experimental -f mp4 -vcodec libx264 -coder 0 -bf 0 -flags2 -wpred-dct8x8 -wpredp 0 -acodec aac -g 100 " . $arguments; $arguments = "-strict experimental -f mp4 -vcodec libx264 -vpre medium -acodec aac -g 100 " . $arguments; //clime } else { if ($this->getFormat() == "webm") { $arguments = "-f webm -vcodec libvpx -acodec libvorbis -ar 44000 -g 100 " . $arguments; } else { throw new Exception("Unsupported video output format: " . $this->getFormat()); } } // add some global arguments $arguments = "-threads 0 " . $arguments; $cmd = self::getFfmpegCli() . ' -i ' . realpath($this->file) . ' ' . $arguments . " " . str_replace("/", DIRECTORY_SEPARATOR, $this->getDestinationFile()); error_log($cmd, 3, '/data/hosting/devel-patron/logs/debug'); Pimcore_Tool_Console::execInBackground($cmd, $this->getConversionLogFile()); } else { throw new Exception("There is no destination file for video converter"); } }
/** * @param $path * @return Pimcore_Video_Adapter */ public function save() { if ($this->getDestinationFile()) { if (is_file($this->getConversionLogFile())) { @unlink($this->getConversionLogFile()); } if (is_file($this->getDestinationFile())) { @unlink($this->getDestinationFile()); } // get the argument string from the configurations $arguments = implode(" ", $this->arguments); // add format specific arguments if ($this->getFormat() == "f4v") { $arguments = "-vcodec libx264 -acodec libfaac -f flv -ar 44000 " . $arguments; } else { if ($this->getFormat() == "mp4") { $arguments = "-vcodec libx264 -f mp4 " . $arguments; //$arguments = "-strict experimental -f mp4 -vcodec mpeg4 -acodec aac " . $arguments; } else { if ($this->getFormat() == "webm") { $arguments = "-vcodec libvpx -acodec libvorbis -f webm -ar 44000 " . $arguments; } else { throw new Exception("Unsupported video output format: " . $this->getFormat()); } } } // add some global arguments $arguments = "-threads 4 " . $arguments; $cmd = self::getFfmpegCli() . ' -i ' . $this->file . ' ' . $arguments . " " . $this->getDestinationFile(); Pimcore_Tool_Console::execInBackground($cmd, $this->getConversionLogFile()); } else { throw new Exception("There is no destination file for video converter"); } }