mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(audio): low-samplerate ogg encode + post-2.0 QA hygiene
Quality-VBR ogg (libvorbis -q:a) fixes 8 kHz 'encoder setup failed' in both ogg paths; drop empty COOKIE_SECRET ENV (app auto-generates); emit real bundle extractedSize; fix stale image-pad/compress-pdf QA specs.
This commit is contained in:
@@ -94,7 +94,10 @@ const AUDIO_OUTPUTS: Record<string, AudioOutput> = {
|
||||
".ogg": {
|
||||
ext: ".ogg",
|
||||
contentType: "audio/ogg",
|
||||
encodeArgs: ["-c:a", "libvorbis", "-b:a", "192k"],
|
||||
// Quality-based VBR, not a fixed bitrate: libvorbis fails with "encoder setup
|
||||
// failed" when a high fixed bitrate (192k) is requested for a low sample rate
|
||||
// (e.g. 8 kHz mono). -q:a 6 is ~192 kbps for normal audio and adapts to the rate.
|
||||
encodeArgs: ["-c:a", "libvorbis", "-q:a", "6"],
|
||||
},
|
||||
".opus": {
|
||||
ext: ".opus",
|
||||
|
||||
@@ -43,17 +43,13 @@ export function registerConvertAudio(app: FastifyInstance) {
|
||||
];
|
||||
case "wav":
|
||||
return ["-i", inPath, "-vn", "-c:a", "pcm_s16le", out];
|
||||
case "ogg":
|
||||
return [
|
||||
"-i",
|
||||
inPath,
|
||||
"-vn",
|
||||
"-c:a",
|
||||
"libvorbis",
|
||||
"-b:a",
|
||||
`${settings.bitrateKbps}k`,
|
||||
out,
|
||||
];
|
||||
case "ogg": {
|
||||
// libvorbis ABR (-b:a) fails with "encoder setup failed" when the bitrate is
|
||||
// too high for the source sample rate (e.g. 8 kHz). Use quality VBR (-q:a),
|
||||
// which adapts to the rate. Map bitrate -> quality (~bitrate/32: 192k -> q6).
|
||||
const quality = (settings.bitrateKbps / 32).toFixed(1);
|
||||
return ["-i", inPath, "-vn", "-c:a", "libvorbis", "-q:a", quality, out];
|
||||
}
|
||||
case "flac":
|
||||
return ["-i", inPath, "-vn", "-c:a", "flac", out];
|
||||
case "m4a":
|
||||
|
||||
Reference in New Issue
Block a user