OUTPUT #658 | 7621 karakter | 215 satır
Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-139-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Wed Sep 16 08:25:24 PM +03 2026
System load: 0.14 Processes: 249
Usage of /: 56.9% of 66.98GB Users logged in: 1
Memory usage: 28% IPv4 address for ens160: 213.238.170.219
Swap usage: 3%
* Canonical Workshop gives developers fast, composable, reproducible, and
secure developer environments that are perfect for agentic workflows.
https://ubuntu.com/workshop
Expanded Security Maintenance for Applications is not enabled.
144 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
16 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm
*** System restart required ***
Last login: Wed Sep 16 20:21:04 2026 from 88.253.69.213
root@213-238-170-219:~# temiz; rg -n -C 8 "contact_sheet|linspace|duration|frames|thumbnail|qa\\(" /home/hermes/.hermes/skills/media/shorts-core/scripts/shorts_fast_pipeline.py | tail -n 180
========== YENİ KOMUT | 16.09.2026 20:25:28 ==========
283- break
284-
285: shots = shots[:len(durations)]
286-
287- cmd = [FFMPEG, "-y", "-v", "error"]
288- for shot in shots:
289- cmd += ["-i", str(Path(shot["src"]))]
290-
291- filters = []
292- labels = []
293: for i, (shot, d) in enumerate(zip(shots, durations)):
294- start = float(shot.get("in", 0.0))
295- filters.append(
296- f"[{i}:v]"
297: f"trim=start={start}:duration={d},"
298- f"setpts=PTS-STARTPTS,"
299- f"scale=1080:1920:force_original_aspect_ratio=increase,"
300- f"crop=1080:1920,"
301- f"fps=30,"
302- f"format=yuv420p[v{i}]"
303- )
304- labels.append(f"[v{i}]")
305-
--
317- "-preset", "veryfast",
318- "-crf", "18",
319- "-r", "30",
320- "-movflags", "+faststart",
321- str(out)
322- ]
323- run(cmd)
324-
325:def qa(final, work):
326- probe = run([
327- FFPROBE, "-v", "error",
328: "-show_entries", "format=duration,size,bit_rate",
329- "-show_entries",
330- "stream=index,codec_type,codec_name,width,height,r_frame_rate,channels,sample_rate,pix_fmt",
331- "-of", "json",
332- str(final)
333- ], capture=True)
334- (work / "probe.json").write_text(probe, encoding="utf-8")
335-
336- dec = subprocess.run(
--
341- raise SystemExit("DECODE_FAIL")
342-
343- bf = subprocess.run([
344- FFMPEG, "-hide_banner", "-i", str(final),
345- "-vf", "blackdetect=d=0.2:pix_th=0.02,freezedetect=n=-50dB:d=2.5",
346- "-an", "-f", "null", "-"
347- ], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
348- (work / "black_freeze.log").write_text(bf.stderr, encoding="utf-8")
349: if re.search(r"black_(start|duration)|freeze_(start|duration)", bf.stderr):
350- raise SystemExit("BLACK_FREEZE_FAIL")
351-
352- loud = subprocess.run([
353- FFMPEG, "-hide_banner", "-i", str(final), "-map", "0:a:0",
354- "-af", "loudnorm=I=-16:TP=-1.5:LRA=11:print_format=json",
355- "-f", "null", "-"
356- ], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
357- (work / "loudness.log").write_text(loud.stderr, encoding="utf-8")
358-
359: duration = probe_duration(final)
360: frames = 6
361: fps = frames / max(duration, 0.1)
362- run([
363- FFMPEG, "-y", "-v", "error",
364- "-i", str(final),
365- "-vf",
366- f"fps={fps:.6f}:start_time=0.5:round=near,"
367- "scale=360:640:flags=lanczos,"
368- "tile=3x2:margin=0:padding=0",
369: "-frames:v", "1",
370: str(work / "final_contact_sheet.jpg")
371- ])
372-
373-def main():
374- ap = argparse.ArgumentParser()
375- ap.add_argument("manifest")
376- args = ap.parse_args()
377-
378- manifest_path = Path(args.manifest).resolve()
--
417- if not cached_tts:
418- run([
419- GOOGLE_TTS,
420- "--voice", voice,
421- "--text", narration,
422- "--out", str(raw_google_wav),
423- "--rate", str(google_rate),
424- ])
425: write_proportional_vtt(raw_vtt, narration, probe_duration(raw_google_wav))
426- run([
427- FFMPEG, "-y", "-v", "error",
428- "-i", str(raw_google_wav),
429- "-af", f"adelay={int(pad_start*1000)}:all=1,apad=pad_dur={pad_end}",
430- "-c:a", "pcm_s16le", "-ar", "48000", "-ac", "2", str(wav)
431- ])
432- tts_meta.write_text(json.dumps({
433- "sig": tts_sig, "provider": "google",
--
435- }), encoding="utf-8")
436-
437- cues = parse_vtt(raw_vtt)
438- segments = caption_segments(cues, pad_start)
439- ass = work / "captions.ass"
440- write_ass(ass, segments)
441- bbox_check(ass, work)
442-
443: audio_duration = probe_duration(wav)
444-
445- shots = m["shots"]
446- shot_paths = [Path(x["src"]) for x in shots]
447- visual_sig = stamp(
448- shot_paths + [ass],
449: json.dumps(shots, sort_keys=True, ensure_ascii=False) + f"|dur={audio_duration:.6f}"
450- )
451- visual_meta = work / ".visual.json"
452- master = work / "visual_master.mp4"
453-
454- cached_visual = False
455- if visual_meta.exists() and master.exists():
456- try:
457- cached_visual = json.loads(visual_meta.read_text()).get("sig") == visual_sig
458- except Exception:
459- pass
460-
461- if not cached_visual:
462: build_master(shots, audio_duration, ass, master)
463- visual_meta.write_text(json.dumps({"sig": visual_sig}), encoding="utf-8")
464-
465- final = Path(m.get("output", work / "final.mp4")).resolve()
466- final.parent.mkdir(parents=True, exist_ok=True)
467-
468- mux_extra = "loudnorm=-16,-1.5,11|aac=192k|ar=48000|shortest|copy-video"
469- final_sig = stamp([master, wav], mux_extra)
470- final_meta = work / ".final.json"
--
521- )
522- else:
523- final_md5 = final_info["video_md5"]
524-
525- qa_sig = stamp([final], "deterministic-final-qa-v1")
526- qa_meta = work / ".qa.json"
527- cached_qa = False
528-
529: if qa_meta.exists() and (work / "final_contact_sheet.jpg").exists():
530- try:
531- cached_qa = json.loads(
532- qa_meta.read_text(encoding="utf-8")
533- ).get("sig") == qa_sig
534- except Exception:
535- pass
536-
537- if not cached_qa:
538: qa(final, work)
539- qa_meta.write_text(
540- json.dumps({"sig": qa_sig, "pass": True}, indent=2),
541- encoding="utf-8"
542- )
543-
544- result = {
545- "pass": True,
546- "version": VERSION,
547- "cached_tts": cached_tts,
548- "cached_visual": cached_visual,
549- "cached_final": cached_final,
550- "cached_qa": cached_qa,
551: "duration": probe_duration(final),
552- "final": str(final),
553: "contact_sheet": str(work / "final_contact_sheet.jpg"),
554- "video_md5": final_md5,
555- }
556- (work / "pipeline_result.json").write_text(
557- json.dumps(result, ensure_ascii=False, indent=2),
558- encoding="utf-8"
559- )
560- print(json.dumps(result, ensure_ascii=False))
561-
root@213-238-170-219:~#