Spaces:
Paused
Paused
Tilawa Server commited on
Commit Β·
de62675
1
Parent(s): a8d14b8
fix: v11 series - L() stdout + T-7 MP3 encode
Browse files- engine_tajalli_v1.py +17 -5
engine_tajalli_v1.py
CHANGED
|
@@ -632,6 +632,7 @@ def process(
|
|
| 632 |
|
| 633 |
def L(msg: str):
|
| 634 |
_LOG.append(msg)
|
|
|
|
| 635 |
log(msg)
|
| 636 |
|
| 637 |
ref_files = [r for r in (ref_files or []) if os.path.exists(r)]
|
|
@@ -827,15 +828,26 @@ def process(
|
|
| 827 |
current_path = noor_out
|
| 828 |
res.noor_applied = True
|
| 829 |
|
| 830 |
-
# ββ T-7: Final
|
| 831 |
L('\nββ T-7: Output βββββββββββββββββββββββββββββββββββββββββββββ')
|
| 832 |
if os.path.exists(current_path):
|
| 833 |
os.makedirs(os.path.dirname(os.path.abspath(output_path)),
|
| 834 |
exist_ok=True)
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 839 |
else:
|
| 840 |
L(' β No output produced β pipeline failed')
|
| 841 |
|
|
|
|
| 632 |
|
| 633 |
def L(msg: str):
|
| 634 |
_LOG.append(msg)
|
| 635 |
+
print(msg, flush=True)
|
| 636 |
log(msg)
|
| 637 |
|
| 638 |
ref_files = [r for r in (ref_files or []) if os.path.exists(r)]
|
|
|
|
| 828 |
current_path = noor_out
|
| 829 |
res.noor_applied = True
|
| 830 |
|
| 831 |
+
# ββ T-7: Final encode to MP3 320kbps ββββββββββββββββββββββββββββββββββββ
|
| 832 |
L('\nββ T-7: Output βββββββββββββββββββββββββββββββββββββββββββββ')
|
| 833 |
if os.path.exists(current_path):
|
| 834 |
os.makedirs(os.path.dirname(os.path.abspath(output_path)),
|
| 835 |
exist_ok=True)
|
| 836 |
+
_enc = subprocess.run([
|
| 837 |
+
'ffmpeg', '-y', '-i', current_path,
|
| 838 |
+
'-af', 'alimiter=limit=0.891:level=false:attack=1:release=15',
|
| 839 |
+
'-b:a', '320k', '-ar', '48000', '-ac', '2',
|
| 840 |
+
output_path, '-loglevel', 'error'
|
| 841 |
+
], capture_output=True)
|
| 842 |
+
if _enc.returncode == 0 and os.path.exists(output_path):
|
| 843 |
+
res.output_sha256 = _sha256(output_path)
|
| 844 |
+
_sz = os.path.getsize(output_path) // 1024
|
| 845 |
+
L(f' β MP3 encoded β {output_path} [{_sz}KB]')
|
| 846 |
+
L(f' SHA256 : {res.output_sha256}')
|
| 847 |
+
L(f' LUFS={res.lufs_out:.2f} Crest={res.crest_out:.2f} LRA={res.lra_out:.2f}')
|
| 848 |
+
else:
|
| 849 |
+
L(f' β ffmpeg encode failed β raw copy fallback')
|
| 850 |
+
shutil.copy2(current_path, output_path)
|
| 851 |
else:
|
| 852 |
L(' β No output produced β pipeline failed')
|
| 853 |
|