Model/EpisodeAssetDataJob.php
private function getStreamInformationsOfEpisode($episode)
    {
        $uri = $this->getContainer()->get('bprs.asset_helper')->getAbsoluteUrl($episode->getVideo());
        if (!$uri) { // can't create uri of episode video
            $this->logbook->error('oktolab_media.episode_assetdatajob_nourl', [], $this->args['uniqID']);
            return false;
        }
        $metadata = ['video' => false, 'audio' => false];
        try {
            $metainfo = json_decode(shell_exec(sprintf('ffprobe -v error -show_streams -print_format json %s', $uri)), true);
            foreach ($metainfo['streams'] as $stream) {
                if ($metadata['video'] && $metadata['audio']) {
                    break;
                }
                if ($stream['codec_type'] == "audio") {
                    $metadata['audio'] = $stream;
                }
                if ($stream['codec_type'] == "video") {
                    $metadata['video'] = $stream;
                }
            }
        } catch (Exception $e) {
            $metadata = null;
        }

        return $metadata;
    }
private function getStreamInformationsOfEpisode($episode)
    {
        $uri = $this->getContainer()->get('bprs.asset_helper')->getAbsoluteUrl($episode->getVideo());
        if (!$uri) { // can't create uri of episode video
            $this->logbook->error('oktolab_media.episode_assetdatajob_nourl', [], $this->args['uniqID']);
            return false;
        }
        $metadata = ['video' => false, 'audio' => false];
        try {
            $metainfo = json_decode(shell_exec(sprintf('ffprobe -v error -show_streams -print_format json %s', $uri)), true);
            foreach ($metainfo['streams'] as $stream) {
                if ($metadata['video'] && $metadata['audio']) {
                    break;
                }
                if ($stream['codec_type'] == "audio") {
                    $metadata['audio'] = $stream;
                }
                if ($stream['codec_type'] == "video") {
                    $metadata['video'] = $stream;
                }
            }
        } catch (Exception $e) {
            $metadata = null;
        }

        return $metadata;
    }
private function getStreamInformationsOfEpisode ( $ episode ) { $ uri = $ this -> getContainer ( ) -> get ( 'bprs.asset_helper' ) -> getAbsoluteUrl ( $ episode -> getVideo ( ) ) ; if ( ! $ uri ) { // can't create uri of episode video $ this -> logbook -> error ( 'oktolab_media.episode_assetdatajob_nourl' , [ ] , $ this -> args [ 'uniqID' ] ) ; return false ; } $ metadata = [ 'video' => false , 'audio' => false ] ; try { $ metainfo = json_decode ( shell_exec ( sprintf ( 'ffprobe -v error -show_streams -print_format json %s' , $ uri ) ) , true ) ; foreach ( $ metainfo [ 'streams' ] as $ stream ) { if ( $ metadata [ 'video' ] && $ metadata [ 'audio' ] ) { break ; } if ( $ stream [ 'codec_type' ] == "audio" ) { $ metadata [ 'audio' ] = $ stream ; } if ( $ stream [ 'codec_type' ] == "video" ) { $ metadata [ 'video' ] = $ stream ; } } } catch ( Exception $ e ) { $ metadata = null ; } return $ metadata ; }
extracts streaminformations of an episode from its video.
returns false if informations can't be extracted
returns array of video and audio info.
extracts streaminformations of an episode from its video . returns false if informations can t be extracted returns array of video and audio info .