diff --git a/lib/php/rendition-factory/src/Command/CreateCommand.php b/lib/php/rendition-factory/src/Command/CreateCommand.php index f1821e0ad..9ee330de9 100644 --- a/lib/php/rendition-factory/src/Command/CreateCommand.php +++ b/lib/php/rendition-factory/src/Command/CreateCommand.php @@ -32,7 +32,7 @@ protected function configure(): void $this->addArgument('src', InputArgument::REQUIRED, 'The source file'); $this->addArgument('build-config', InputArgument::REQUIRED, 'The build config YAML file'); - $this->addOption('type', 't', InputOption::VALUE_OPTIONAL, 'Force the MIME type of file'); + $this->addOption('type', 't', InputOption::VALUE_REQUIRED, 'Force the MIME type of file'); $this->addOption('working-dir', 'w', InputOption::VALUE_REQUIRED, 'The working directory. Defaults to system temp directory'); $this->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'The output file name WITHOUT extension'); $this->addOption('debug', 'd', InputOption::VALUE_NONE, 'set to debug mode (keep files in working directory)'); @@ -72,6 +72,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $buildConfig, $options ); + $output->writeln(sprintf('Rendition created: %s', $outputFile->getPath())); + } catch (\InvalidArgumentException $e) { $output->writeln(sprintf('%s', $e->getMessage())); @@ -91,8 +93,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int return 1; } - $output->writeln(sprintf('Rendition created: %s', $outputFile->getPath())); - if (!$input->getOption('debug')) { $this->renditionCreator->cleanUp(); } diff --git a/lib/php/rendition-factory/src/Config/YamlLoader.php b/lib/php/rendition-factory/src/Config/YamlLoader.php index 2dac57c54..bed285f97 100644 --- a/lib/php/rendition-factory/src/Config/YamlLoader.php +++ b/lib/php/rendition-factory/src/Config/YamlLoader.php @@ -70,6 +70,7 @@ private function parseTransformation(array $transformation): Transformation { return new Transformation( $transformation['module'], + $transformation['enabled'] ?? true, $transformation['options'] ?? [], $transformation['description'] ?? null ); diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/FormatInterface.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/FormatInterface.php new file mode 100644 index 000000000..493ac99d3 --- /dev/null +++ b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/FormatInterface.php @@ -0,0 +1,18 @@ +format = new X264(); + } + + public static function getAllowedExtensions(): array + { + return ['mkv']; + } + + public static function getMimeType(): string + { + return 'video/x-matroska'; + } + + public static function getFormat(): string + { + return 'video-mkv'; + } + + public static function getFamily(): FamilyEnum + { + return FamilyEnum::Video; + } + + public function getFFMpegFormat(): VideoInterface + { + return $this->format; + } +} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Mpeg4Format.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Mpeg4Format.php new file mode 100644 index 000000000..6280581d3 --- /dev/null +++ b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Mpeg4Format.php @@ -0,0 +1,42 @@ +format = new X264(); + } + + public static function getAllowedExtensions(): array + { + return ['mp4']; + } + + public static function getMimeType(): string + { + return 'video/mp4'; + } + + public static function getFormat(): string + { + return 'video-mpeg4'; + } + + public static function getFamily(): FamilyEnum + { + return FamilyEnum::Video; + } + + public function getFFMpegFormat(): VideoInterface + { + return $this->format; + } +} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/MpegFormat.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/MpegFormat.php new file mode 100644 index 000000000..914fcb3e5 --- /dev/null +++ b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/MpegFormat.php @@ -0,0 +1,42 @@ +format = new X264(); + } + + public static function getAllowedExtensions(): array + { + return ['mpeg']; + } + + public static function getMimeType(): string + { + return 'video/mpeg'; + } + + public static function getFormat(): string + { + return 'video-mpeg'; + } + + public static function getFamily(): FamilyEnum + { + return FamilyEnum::Video; + } + + public function getFFMpegFormat(): VideoInterface + { + return $this->format; + } +} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/QuicktimeFormat.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/QuicktimeFormat.php new file mode 100644 index 000000000..951e10bed --- /dev/null +++ b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/QuicktimeFormat.php @@ -0,0 +1,42 @@ +format = new X264(); + } + + public static function getAllowedExtensions(): array + { + return ['mov']; + } + + public static function getMimeType(): string + { + return 'video/quicktime'; + } + + public static function getFormat(): string + { + return 'video-quicktime'; + } + + public static function getFamily(): FamilyEnum + { + return FamilyEnum::Video; + } + + public function getFFMpegFormat(): VideoInterface + { + return $this->format; + } +} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/WebM.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/WebM.php deleted file mode 100644 index 63f2b5e6b..000000000 --- a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/WebM.php +++ /dev/null @@ -1,22 +0,0 @@ -videoCodecs = parent::getAvailableVideoCodecs(); - if (!in_array('copy', $this->videoCodecs)) { - $this->videoCodecs[] = 'copy'; - } - parent::__construct($audioCodec, $videoCodec); - } - - public function getAvailableVideoCodecs() - { - return $this->videoCodecs; - } -} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/X264.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/X264.php deleted file mode 100644 index c303ab82d..000000000 --- a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/Video/X264.php +++ /dev/null @@ -1,22 +0,0 @@ -videoCodecs = parent::getAvailableVideoCodecs(); - if (!in_array('copy', $this->videoCodecs)) { - $this->videoCodecs[] = 'copy'; - } - parent::__construct($audioCodec, $videoCodec); - } - - public function getAvailableVideoCodecs() - { - return $this->videoCodecs; - } -} diff --git a/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/WebmFormat.php b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/WebmFormat.php new file mode 100644 index 000000000..e9f98cd6a --- /dev/null +++ b/lib/php/rendition-factory/src/Transformer/Video/FFMpeg/Format/WebmFormat.php @@ -0,0 +1,42 @@ +format = new WebM(); + } + + public static function getAllowedExtensions(): array + { + return ['webm']; + } + + public static function getMimeType(): string + { + return 'video/webm'; + } + + public static function getFormat(): string + { + return 'video-webm'; + } + + public static function getFamily(): FamilyEnum + { + return FamilyEnum::Video; + } + + public function getFFMpegFormat(): VideoInterface + { + return $this->format; + } +}