map = $map; } public function setInput(string $input): static { $this->input = $input; return $this; } public function addFlag(string $key, string $value): static { $this->flags[$key] = $value; return $this; } public function setCodec(FormatInterface $codec): static { $this->codec = $codec; return $this; } protected function parseCodec(): static { // @todo $this->addFlag('c', 'libx265'); return $this; } public function saveStream(): Map { $this->map->saveStream($this); return $this->map; } public function buildCommand(int $idx = 0): array { $this->parseCodec(); $commands = []; $commands[] = '-map'; $commands[] = $this->input; foreach ($this->flags as $k => $v) { array_push($commands, "-{$k}:{$idx}", $v); } foreach ($this->metadata as $k => $v) { array_push($commands, "-metadata:s:{$idx}", "{$k}={$v}"); } return $commands; } }