Improve video and audio bitrate recommendations
Some checks failed
Push & Release 🌍 / Automation 🎛️ (push) Has been cancelled
Push & Release 🌍 / Unstable release 🚀⚠️ (push) Has been cancelled
Push & Release 🌍 / Quality checks 👌🧪 (push) Has been cancelled
Push & Release 🌍 / GitHub CodeQL 🔬 (push) Has been cancelled
Push & Release 🌍 / Deploy 🚀 (push) Has been cancelled

Video improvements:
- Increase quality options from 3 to 6 levels (Maximum, Very High, High,
  Medium, Low, Minimum) for better granularity
- Update bitrate ranges to 2025 standards:
  * 480p: 1-2.5 Mbps (was 0.36-0.73 Mbps)
  * 720p: 2.5-8 Mbps (was 3-6 Mbps)
  * 1080p: 5-16 Mbps (was 6-13.5 Mbps)
  * 1440p: 12-35 Mbps (was 13.5-28 Mbps)
  * 4K: 25-80 Mbps (was 28-50 Mbps)
- Adjust AV1 efficiency factor to 45% (was 50%, more realistic)
- Default selection changed to "High" instead of middle option

Audio improvements:
- Add codec-specific maximum bitrates:
  * AAC: 512 kbps (multi-channel)
  * AC3: 640 kbps (spec maximum)
  * E-AC3: 1536 kbps (Atmos capable)
  * Opus: 510 kbps
  * MP3: 320 kbps
- Update recommended bitrates to streaming standards:
  * AAC 5.1: 256 kbps (was 448 kbps, Netflix standard)
  * AAC 7.1: 384 kbps (was 640 kbps)
  * E-AC3: 224/384/768 kbps for 2.0/5.1/7.1
  * Opus: 128/256/384 kbps (very efficient codec)
  * MP3: 192 kbps (was 320 kbps, sufficient for stereo)
- Expand audio bitrate options from 96-768 kbps to 64-1536 kbps
- Change default from 320 kbps to 192 kbps (more appropriate)
- Add intermediate values (160, 224, 510, 1024 kbps)

All minimum values remain accessible for low-bandwidth scenarios.
This commit is contained in:
mani
2026-01-08 00:52:01 +01:00
parent b7dda0a89f
commit 5ecb120298
2 changed files with 58 additions and 42 deletions

View File

@@ -13,29 +13,31 @@ let currentItem;
let currentApiClient;
function getBitrateOptionsForResolutionAndCodec(resolution, codec) {
// Codec efficiency factors based on reference tables
// Codec efficiency factors based on real-world performance
const codecFactors = {
'h264': 1.0,
'hevc': 0.6, // 40% more efficient
'vp9': 0.6, // 40% more efficient
'av1': 0.5 // 50% more efficient
'av1': 0.55 // 45% more efficient
};
// Base bitrate ranges for H.264 (30fps SDR)
// Base bitrate ranges for H.264 (updated for 2025 standards)
const baseRanges = {
'3840': { min: 28000000, max: 50000000, label: '4K' }, // 4K
'2560': { min: 13500000, max: 28000000, label: '1440p' }, // 1440p
'1920': { min: 6000000, max: 13500000, label: '1080p' }, // 1080p
'1280': { min: 3000000, max: 6000000, label: '720p' }, // 720p
'640': { min: 365000, max: 730000, label: '480p' }, // 480p
'3840': { min: 25000000, max: 80000000, label: '4K' }, // 25-80 Mbps
'2560': { min: 12000000, max: 35000000, label: '1440p' }, // 12-35 Mbps
'1920': { min: 5000000, max: 16000000, label: '1080p' }, // 5-16 Mbps
'1280': { min: 2500000, max: 8000000, label: '720p' }, // 2.5-8 Mbps
'640': { min: 1000000, max: 2500000, label: '480p' }, // 1-2.5 Mbps
'original': { min: 50000000, max: 120000000, label: 'Original' }
};
if (resolution === 'original') {
return [
{ bitrate: 120000000, name: 'Maximum' },
{ bitrate: 120000000, name: 'Extreme Quality' },
{ bitrate: 100000000, name: 'Maximum' },
{ bitrate: 80000000, name: 'High' },
{ bitrate: 50000000, name: 'Medium' }
{ bitrate: 60000000, name: 'Medium' },
{ bitrate: 50000000, name: 'Standard' }
];
}
@@ -44,11 +46,15 @@ function getBitrateOptionsForResolutionAndCodec(resolution, codec) {
const min = Math.round(range.min * factor);
const max = Math.round(range.max * factor);
const recommended = Math.round((min + max) / 2);
const step = (max - min) / 5;
// Generate 6 quality levels
return [
{ bitrate: max, name: `Maximum (${range.label})` },
{ bitrate: recommended, name: `Recommended (${range.label})` },
{ bitrate: Math.round(max - step), name: `Very High (${range.label})` },
{ bitrate: Math.round(max - step * 2), name: `High (${range.label})` },
{ bitrate: Math.round(max - step * 3), name: `Medium (${range.label})` },
{ bitrate: Math.round(max - step * 4), name: `Low (${range.label})` },
{ bitrate: min, name: `Minimum (${range.label})` }
];
}
@@ -69,7 +75,7 @@ function populateQualityOptions(dlg, item) {
const options = getBitrateOptionsForResolutionAndCodec(resolution, codec);
selectQuality.innerHTML = options.map((option, index) => {
const selected = index === 1 ? ' selected' : ''; // Select "Recommended"
const selected = index === 2 ? ' selected' : ''; // Select "High" (3rd option)
const mbps = (option.bitrate / 1000000).toFixed(1);
return `<option value="${option.bitrate}"${selected}>${option.name} - ${mbps} Mbps</option>`;
}).join('');
@@ -95,36 +101,49 @@ function populateAudioTracks(dlg, item) {
}
function getRecommendedAudioBitrate(codec, channels) {
// Recommended bitrates based on codec and channel count
// Recommended bitrates based on codec and channel count (2025 standards)
const bitrates = {
'aac': {
2: 192000, // Stereo
6: 448000, // 5.1
8: 640000 // 7.1
2: 192000, // Stereo - transparent quality
6: 256000, // 5.1 - Netflix/streaming standard
8: 384000 // 7.1 - high quality
},
'ac3': {
2: 192000,
6: 448000, // Dolby Digital standard
8: 640000
2: 192000, // Stereo
6: 448000, // 5.1 - Dolby Digital standard (fixed at 448k)
8: 640000 // 7.1 - Dolby Digital spec maximum
},
'eac3': {
2: 192000,
6: 448000,
8: 768000
2: 224000, // Stereo - DD+ improved quality
6: 384000, // 5.1 - DD+ standard
8: 768000 // 7.1 - DD+ maximum
},
'opus': {
2: 128000,
6: 320000,
8: 450000
2: 128000, // Stereo - excellent quality (Opus is very efficient)
6: 256000, // 5.1 - high quality
8: 384000 // 7.1 - very high quality
},
'mp3': {
2: 320000,
6: 320000,
8: 320000
2: 192000, // Stereo - "very high quality" (320k is overkill)
6: 192000, // Downmix to stereo (MP3 doesn't support multichannel)
8: 192000 // Downmix to stereo
}
};
return bitrates[codec]?.[channels] || bitrates[codec]?.[2] || 320000;
return bitrates[codec]?.[channels] || bitrates[codec]?.[2] || 192000;
}
function getMaxAudioBitrate(codec) {
// Maximum sensible bitrates per codec
const maxBitrates = {
'aac': 512000, // AAC practical max for 7.1
'ac3': 640000, // AC3 spec maximum
'eac3': 1536000, // E-AC3 spec maximum (Atmos capable)
'opus': 510000, // Opus practical max (very efficient)
'mp3': 320000 // MP3 spec maximum
};
return maxBitrates[codec] || 640000;
}
function updateAudioBitrateOptions(dlg) {
@@ -145,16 +164,7 @@ function updateAudioBitrateOptions(dlg) {
audioBitrateContainer.style.display = 'block';
}
// Codec-specific maximum bitrates (in bps)
const codecMaxBitrates = {
'mp3': 320000, // MP3 spec maximum
'aac': 640000, // Practical max for multi-channel AAC
'ac3': 640000, // Dolby Digital maximum
'eac3': 768000, // Dolby Digital Plus practical max
'opus': 512000 // Opus practical max (very efficient)
};
const maxBitrate = codecMaxBitrates[codec] || 768000;
const maxBitrate = getMaxAudioBitrate(codec);
const recommendedBitrate = getRecommendedAudioBitrate(codec, channels);
// Filter and update bitrate options based on codec

View File

@@ -62,17 +62,23 @@
<div class="selectContainer">
<label class="selectLabel" for="selectAudioBitrate">${LabelAudioBitrate}</label>
<select is="emby-select" id="selectAudioBitrate" class="emby-select-withcolor emby-select">
<option value="1536000">1536 kbps</option>
<option value="1024000">1024 kbps</option>
<option value="768000">768 kbps</option>
<option value="640000">640 kbps</option>
<option value="512000">512 kbps</option>
<option value="510000">510 kbps</option>
<option value="450000">450 kbps</option>
<option value="448000">448 kbps</option>
<option value="384000">384 kbps</option>
<option value="320000" selected>320 kbps</option>
<option value="320000">320 kbps</option>
<option value="256000">256 kbps</option>
<option value="192000">192 kbps</option>
<option value="224000">224 kbps</option>
<option value="192000" selected>192 kbps</option>
<option value="160000">160 kbps</option>
<option value="128000">128 kbps</option>
<option value="96000">96 kbps</option>
<option value="64000">64 kbps</option>
</select>
</div>
</div>