protected function createConverter($targetFormat, $profileName) {
    $profile = $this->getProfile($profileName);

    $videoContainers = $this->config['videoContainers'];
    if (!isset($videoContainers[$targetFormat])) {
      throw new \Exception("Unsupported target video container");
    }
    $targetConfig = $videoContainers[$targetFormat];
    if (!isset($targetConfig['videoEncoder']) || !isset($targetConfig['audioEncoder'])) {
      throw new \Exception("Video or audio encoder are missing for target format $targetFormat");
    }

    $videoEncoder = $this->searchEncoder($targetConfig['videoEncoder']);
    if (!$videoEncoder) {
      throw new \Exception("Video encoder not found for video codec {$targetConfig['videoEncoder']} for $targetFormat");
    }
    $audioEncoder = $this->searchEncoder($targetConfig['audioEncoder']);
    if (!$audioEncoder) {
      throw new \Exception("Audio encoder not found for audio codec {$targetConfig['audioEncoder']} for $targetFormat");
    }

    if ($targetFormat == 'mp4') {
      return new Converter\Mp4Converter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
    }
    return new Converter\GenericConverter($this->Process, $this->getDriver(), $this->config, $profile, $videoEncoder, $audioEncoder);
  }