GuessEncoderOptions example

foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) {
                    if ($streamdata['dataformat'] == $thisfile_audio_dataformat) {
                        $thisfile_audio['streams'][$streamnumber]['sample_rate']  = $thisfile_audio['sample_rate'];
                        $thisfile_audio['streams'][$streamnumber]['channels']     = $thisfile_audio['channels'];
                        $thisfile_audio['streams'][$streamnumber]['bitrate']      = $thisfile_audio['bitrate'];
                        $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
                        $thisfile_audio['streams'][$streamnumber]['codec']        = $thisfile_audio['codec'];
                    }
                }
            }
            $getid3_mp3 = new getid3_mp3($this->getid3);
            $thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions();
            unset($getid3_mp3);
        }


        if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) {
            switch ($thisfile_audio_dataformat) {
                case 'ac3':
                    // ignore bits_per_sample                     break;

                default:
                    
$info['audio']['lossless'] = false;

        // Calculate playtime         if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) {
            // https://github.com/JamesHeinrich/getID3/issues/161             // VBR header frame contains ~0.026s of silent audio data, but is not actually part of the original encoding and should be ignored             $xingVBRheaderFrameLength = ((isset($info['mpeg']['audio']['VBR_frames']) && isset($info['mpeg']['audio']['framelength'])) ? $info['mpeg']['audio']['framelength'] : 0);

            $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset'] - $xingVBRheaderFrameLength) * 8 / $info['audio']['bitrate'];
        }

        $info['audio']['encoder_options'] = $this->GuessEncoderOptions();

        return true;
    }

    /** * @return string */
    public function GuessEncoderOptions() {
        // shortcuts         $info = &$this->getid3->info;
        $thisfile_mpeg_audio = array();
        
Home | Imprint | This part of the site doesn't use cookies.