Update to better hand h265 / x265 encoded files.

This commit is contained in:
Brian McGonagill 2026-03-13 08:48:02 -05:00
parent 0e10143b5c
commit cdd27043a2
3 changed files with 101 additions and 12 deletions

View file

@ -767,6 +767,35 @@ body {
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 2px 7px;
border-radius: var(--radius-pill);
border: 1px solid var(--border-base);
background: var(--bg-card2);
white-space: nowrap;
}
/* H.265 / HEVC — amber tint to flag it uses libx265 */
.codec-tag.hevc {
background: rgba(180, 100, 0, 0.10);
border-color: rgba(180, 100, 0, 0.35);
color: #7a4500;
}
[data-theme="dark"] .codec-tag.hevc {
background: rgba(251, 191, 36, 0.12);
border-color: rgba(251, 191, 36, 0.30);
color: #fbbf24;
}
/* H.264 / AVC — subtle blue tint */
.codec-tag.h264 {
background: rgba(26, 86, 219, 0.07);
border-color: rgba(26, 86, 219, 0.25);
color: #1e40af;
}
[data-theme="dark"] .codec-tag.h264 {
background: rgba(147, 197, 253, 0.10);
border-color: rgba(147, 197, 253, 0.25);
color: #93c5fd;
}
/* Checkbox styling */

View file

@ -272,11 +272,19 @@ function showScanStatus(msg, type) {
function renderFileTable(files) {
let html = '';
files.forEach((f, idx) => {
const sizeFmt = f.size_gb.toFixed(3);
const sizeFmt = f.size_gb.toFixed(3);
const curBitrate = f.bit_rate_mbps ? `${f.bit_rate_mbps} Mbps` : 'Unknown';
const tgtBitrate = f.target_bit_rate_mbps ? `${f.target_bit_rate_mbps} Mbps` : '—';
const codec = f.codec || 'unknown';
const pathDir = f.path.replace(f.name, '');
const codec = (f.codec || 'unknown').toLowerCase();
const pathDir = f.path.replace(f.name, '');
// Normalise codec label and pick a CSS modifier for the badge colour
const isHevc = ['hevc', 'h265', 'x265'].includes(codec);
const isH264 = ['h264', 'avc', 'x264'].includes(codec);
const codecLabel = isHevc ? 'H.265 / HEVC'
: isH264 ? 'H.264 / AVC'
: codec.toUpperCase();
const codecMod = isHevc ? 'hevc' : isH264 ? 'h264' : '';
html += `
<tr id="row-${idx}" data-path="${escHtml(f.path)}">
@ -305,7 +313,7 @@ function renderFileTable(files) {
<span class="bitrate-badge target">${escHtml(tgtBitrate)}</span>
</td>
<td class="col-codec">
<span class="codec-tag">${escHtml(codec)}</span>
<span class="codec-tag ${codecMod}" title="Encoder: ${isHevc ? 'libx265' : 'libx264'}">${escHtml(codecLabel)}</span>
</td>
</tr>`;
});
@ -370,6 +378,7 @@ els.compressBtn.addEventListener('click', async () => {
path: f.path,
size_bytes: f.size_bytes,
target_bit_rate_bps: f.target_bit_rate_bps || 1000000,
codec: f.codec || 'unknown',
})),
suffix,
};