File size: 2,474 Bytes
1425afc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | """
V8 Autonomous Viral Engine
--------------------------
Fully automated pipeline for viral video generation.
"""
import os
from utils.transcription import transcribe_video
from utils.highlights import detect_highlights
from utils.clipper import create_clips
from utils.srt import generate_srt
from utils.render import render_subtitles
from utils.variations import generate_hooks
from utils.pacing import pacing_engine
from utils.viral_scorer import score_clip
# =====================================================
# CORE AUTONOMOUS PIPELINE
# =====================================================
def run_autonomous_engine(video_path):
"""
One-call system → full viral pipeline
"""
print("[V8 ENGINE] Starting autonomous pipeline...")
# 1. TRANSCRIBE
words = transcribe_video(video_path)
# 2. DETECT HIGHLIGHTS
highlights = detect_highlights(words)
if not highlights:
return {
"status": "failed",
"reason": "No highlights detected"
}
# 3. AUTO CLIP GENERATION
clips = create_clips(video_path, highlights)
if not clips:
return {
"status": "failed",
"reason": "Clip generation failed"
}
outputs = []
# 4. PROCESS EACH CLIP AUTONOMOUSLY
for i, clip in enumerate(clips):
try:
clip_words = transcribe_video(clip)
# 5. CAPTIONS
srt = generate_srt(clip_words)
# 6. PACING OPTIMIZATION (NEW V8)
paced_clip = pacing_engine(clip, clip_words)
# 7. HOOK VARIATIONS
hooks = generate_hooks(clip_words)
# 8. RENDER OUTPUT
output_path = clip.replace(".mp4", f"_v8_{i}.mp4")
final_video = render_subtitles(
paced_clip,
srt,
output_path
)
# 9. VIRAL SCORING
score = score_clip(clip_words)
outputs.append({
"clip": final_video,
"score": score,
"hooks": hooks[:3],
"index": i
})
except Exception as e:
print(f"[V8 ENGINE] Clip {i} failed:", str(e))
continue
# 10. SORT BY VIRAL SCORE
outputs = sorted(outputs, key=lambda x: x["score"], reverse=True)
return {
"status": "completed",
"best_clip": outputs[0] if outputs else None,
"all_variants": outputs
} |