original_string: private function executeFFmpegForMedia($cmd, $format, $resolution, $media) {
          $ffmpeg_start = microtime(true);
          $this->getContainer()->get('oktolab_media_ffmpeg')
              ->executeFFmpegForMedia(
                  $resolution['encoder'],
                  $cmd,
                  $media
              )
          ;
          $ffmpeg_stop = microtime(true);
  
          $media->setStatus(Media::OKTOLAB_MEDIA_STATUS_MEDIA_FINISHED);
          $media->setPublic($resolution['public']);
          $this->em->persist($media);
          $this->em->flush();
  
          $this->logbook->info(
              'oktolab_media.episode_end_saving_media',
              [
                  '%format%' => $format,
                  '%seconds%' => round($ffmpeg_stop - $ffmpeg_start)
              ],
              $this->args['uniqID']
          );
  
          // move encoded media from "cache" to config adapter or adapter of the original file
          $this->getContainer()->get('bprs.asset')->moveAsset(
              $media->getAsset(),
              $resolution['adapter'] ? $resolution['adapter'] : $media->getEpisode()->getVideo()->getAdapter()
          );
  
          // add finalize episode job, set new episode status
          if (!$this->added_finalize) {
              $this->finalizeEpisode($media->getEpisode());
              $this->added_finalize = true;
          }
      }
code: private function executeFFmpegForMedia($cmd, $format, $resolution, $media) {
          $ffmpeg_start = microtime(true);
          $this->getContainer()->get('oktolab_media_ffmpeg')
              ->executeFFmpegForMedia(
                  $resolution['encoder'],
                  $cmd,
                  $media
              )
          ;
          $ffmpeg_stop = microtime(true);
  
          $media->setStatus(Media::OKTOLAB_MEDIA_STATUS_MEDIA_FINISHED);
          $media->setPublic($resolution['public']);
          $this->em->persist($media);
          $this->em->flush();
  
          $this->logbook->info(
              'oktolab_media.episode_end_saving_media',
              [
                  '%format%' => $format,
                  '%seconds%' => round($ffmpeg_stop - $ffmpeg_start)
              ],
              $this->args['uniqID']
          );
  
          // move encoded media from "cache" to config adapter or adapter of the original file
          $this->getContainer()->get('bprs.asset')->moveAsset(
              $media->getAsset(),
              $resolution['adapter'] ? $resolution['adapter'] : $media->getEpisode()->getVideo()->getAdapter()
          );
  
          // add finalize episode job, set new episode status
          if (!$this->added_finalize) {
              $this->finalizeEpisode($media->getEpisode());
              $this->added_finalize = true;
          }
      }
code_tokens: private function executeFFmpegForMedia ( $ cmd , $ format , $ resolution , $ media ) { $ ffmpeg_start = microtime ( true ) ; $ this -> getContainer ( ) -> get ( 'oktolab_media_ffmpeg' ) -> executeFFmpegForMedia ( $ resolution [ 'encoder' ] , $ cmd , $ media ) ; $ ffmpeg_stop = microtime ( true ) ; $ media -> setStatus ( Media :: OKTOLAB_MEDIA_STATUS_MEDIA_FINISHED ) ; $ media -> setPublic ( $ resolution [ 'public' ] ) ; $ this -> em -> persist ( $ media ) ; $ this -> em -> flush ( ) ; $ this -> logbook -> info ( 'oktolab_media.episode_end_saving_media' , [ '%format%' => $ format , '%seconds%' => round ( $ ffmpeg_stop - $ ffmpeg_start ) ] , $ this -> args [ 'uniqID' ] ) ; // move encoded media from "cache" to config adapter or adapter of the original file $ this -> getContainer ( ) -> get ( 'bprs.asset' ) -> moveAsset ( $ media -> getAsset ( ) , $ resolution [ 'adapter' ] ? $ resolution [ 'adapter' ] : $ media -> getEpisode ( ) -> getVideo ( ) -> getAdapter ( ) ) ; // add finalize episode job, set new episode status if ( ! $ this -> added_finalize ) { $ this -> finalizeEpisode ( $ media -> getEpisode ( ) ) ; $ this -> added_finalize = true ; } }
docstring: creates a media object and runs the ffmpeg command for the given resolution.
  the command will be tracked to update the progress from 0 - 100 in realtime.
  will move the asset from the cache adapter to the adapter in the resolution if defined.
  triggers the finalize episode function once for the whole job
docstring_tokens: creates a media object and runs the ffmpeg command for the given resolution . the command will be tracked to update the progress from 0 - 100 in realtime . will move the asset from the cache adapter to the adapter in the resolution if defined . triggers the finalize episode function once for the whole job