Compact HE-AAC audio saves: server lane with fdkaac, shrink saved songs from Saved videos

This commit is contained in:
Jonathan Sykes
2026-10-18 17:28:47 +08:00
parent eef9fbf05f
commit b48d36b3dd
12 changed files with 342 additions and 22 deletions

View File

@@ -293,7 +293,8 @@ export async function initDb() {
try { await db.execute('ALTER TABLE media_cache ADD COLUMN pinned INTEGER NOT NULL DEFAULT 0'); } catch { /* already migrated */ }
// Still-picture songs: still = NULL (not checked yet) | 0 | 1. A still copy
// also has <id>.<gen>.jpg, and devices may save just its m4a (audio_sha256).
for (const col of ['still INTEGER', 'audio_sha256 TEXT']) {
// he_size: NULL = no compact (HE-AAC) audio yet, 0 = could not make one.
for (const col of ['still INTEGER', 'audio_sha256 TEXT', 'he_size INTEGER', 'he_sha256 TEXT']) {
try { await db.execute(`ALTER TABLE media_cache ADD COLUMN ${col}`); } catch { /* already migrated */ }
}
// Uploads shared from devices (PWA share target): who sent it, and whether it
@@ -680,7 +681,7 @@ const MEDIA_COLS = new Set([
'status', 'gen', 'size', 'height', 'vcodec', 'acodec', 'duration', 'optimized',
'meta', 'priority', 'auto', 'attempts', 'error', 'retry_at', 'created_at',
'updated_at', 'last_access', 'hits', 'sha256',
'pinned', 'still', 'audio_sha256',
'pinned', 'still', 'audio_sha256', 'he_size', 'he_sha256',
]);
function rowToObj(res, row) {