getid3_ogg::get_quality_from_nominal_bitrate

Advertisement

Syntax Syntax

getid3_ogg::get_quality_from_nominal_bitrate( int $nominal_bitrate )

Parameters Parameters

$nominal_bitrate

(int) (Required)

Return Return

(float)

Source Source

File: wp-includes/ID3/module.audio.ogg.php

	 * @return float
	 */
	public static function get_quality_from_nominal_bitrate($nominal_bitrate) {

		// decrease precision
		$nominal_bitrate = $nominal_bitrate / 1000;

		if ($nominal_bitrate < 128) {
			// q-1 to q4
			$qval = ($nominal_bitrate - 64) / 16;
		} elseif ($nominal_bitrate < 256) {
			// q4 to q8
			$qval = $nominal_bitrate / 32;
		} elseif ($nominal_bitrate < 320) {
			// q8 to q9
			$qval = ($nominal_bitrate + 256) / 64;
		} else {
			// q9 to q10
			$qval = ($nominal_bitrate + 1300) / 180;
		}
		//return $qval; // 5.031324
		//return intval($qval); // 5

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.