/**
  * {@inheritdoc}
  * @throws LiveBroadcastInputException
  */
 public function generateInputCmd()
 {
     $monitorImage = $this->media->getMonitorImage();
     if (!file_exists($monitorImage)) {
         throw new LiveBroadcastInputException(sprintf('Monitor image \'%s\' not found', $monitorImage));
     }
     return sprintf('-re -f lavfi -i anullsrc=r=48000 -r 1 -loop 1 -i %s', escapeshellarg($monitorImage));
 }
 /**
  * Start a monitor stream with a placeholder image
  *
  * @param YouTubeEvent $event
  * @throws \InvalidArgumentException
  * @throws \RuntimeException
  * @throws \Martin1982\LiveBroadcastBundle\Exception\LiveBroadcastInputException
  */
 protected function startMonitorStream(YouTubeEvent $event)
 {
     $placeholderImage = $this->kernel->locateResource('@LiveBroadcastBundle') . '/Resources/images/placeholder.png';
     $inputMedia = new MediaMonitorStream();
     $inputMedia->setMonitorImage($placeholderImage);
     $inputService = new InputMonitorStream();
     $inputService->setMedia($inputMedia);
     $streamUrl = $this->getYouTubeApiService()->getStreamUrl($event->getBroadcast(), $event->getChannel());
     $outputService = new OutputYouTube();
     $outputService->setChannel($event->getChannel());
     $outputService->setStreamUrl($streamUrl);
     $metadata = array('broadcast_id' => $event->getBroadcast()->getBroadcastId(), 'channel_id' => $event->getChannel()->getChannelId(), 'monitor_stream' => 'yes');
     try {
         $this->logger->info('YouTube start monitor stream', array('broadcast_id' => $metadata['broadcast_id']));
         $this->commands->startProcess($inputService->generateInputCmd(), $outputService->generateOutputCmd(), $metadata);
     } catch (LiveBroadcastOutputException $e) {
         return;
     }
 }