editor.py aktualisiert

This commit is contained in:
2026-09-29 09:56:24 +02:00
parent 872f5fcbaa
commit fd83f93da0
+14 -3
View File
@@ -241,12 +241,16 @@ def create_finished(filename, start, end):
result = subprocess.run( result = subprocess.run(
[ [
"ffmpeg", "-hide_banner", "-loglevel", "warning", "-y", "ffmpeg", "-hide_banner", "-loglevel", "warning", "-y",
"-i", str(source), "-fflags", "+genpts",
"-ss", f"{start:.3f}", "-ss", f"{start:.3f}",
"-i", str(source),
"-t", f"{end - start:.3f}", "-t", f"{end - start:.3f}",
"-map", "0:a:0",
"-vn", "-sn", "-dn",
"-af", "loudnorm=I=-16:TP=-1.5:LRA=11", "-af", "loudnorm=I=-16:TP=-1.5:LRA=11",
"-c:a", "libmp3lame", "-c:a", "libmp3lame",
"-b:a", "128k", "-b:a", "128k",
"-avoid_negative_ts", "make_zero",
str(temp), str(temp),
], ],
capture_output=True, text=True, timeout=1800, capture_output=True, text=True, timeout=1800,
@@ -676,8 +680,15 @@ async function trim() {
msg('Aufnahme wird geschnitten …',true); msg('Aufnahme wird geschnitten …',true);
try { try {
const r=await fetch('/api/edit', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({filename,start,end})}); const r=await fetch('/api/edit', {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({filename,start,end})});
const d=await r.json(); const contentType = r.headers.get('content-type') || '';
if(!r.ok || !d.success) throw new Error(d.error || 'Fehler beim Schneiden'); let d;
if (contentType.includes('application/json')) {
d = await r.json();
} else {
const text = await r.text();
throw new Error(`Serverfehler HTTP ${r.status}: ${text.slice(0, 200)}`);
}
if(!r.ok || !d.success) throw new Error(d.error || `Fehler beim Schneiden (HTTP ${r.status})`);
msg('Fertige Aufnahme erfolgreich erstellt.',true); msg('Fertige Aufnahme erfolgreich erstellt.',true);
setTimeout(()=>location.reload(),700); setTimeout(()=>location.reload(),700);
} catch(e) { msg(e.message,false); btn.disabled=false; } } catch(e) { msg(e.message,false); btn.disabled=false; }