text
stringlengths
3
8.33k
repo
stringclasses
52 values
path
stringlengths
6
141
language
stringclasses
35 values
sha
stringlengths
64
64
chunk_index
int32
0
273
n_tokens
int32
1
896
from __future__ import annotations import logging from pathlib import Path from elevenlabs import ElevenLabs logger = logging.getLogger(__name__) class VoiceChanger: def __init__( self, api_key: str, model_id: str = "eleven_multilingual_sts_v2", ): self.client = ElevenLabs(a...
ai-video
scripts/audio/voice_changer.py
Python
7155f59c509edb9a42206482d895c70909f7906c3c005d1d9157c2d4247bffd7
0
553
from __future__ import annotations import base64 import logging from pathlib import Path from elevenlabs import ElevenLabs from scripts.core.models import VoiceProfile logger = logging.getLogger(__name__) class VoiceDesigner: def __init__(self, api_key: str): self.client = ElevenLabs(api_key=api_key) ...
ai-video
scripts/audio/voice_designer.py
Python
a5b2f92dad93627a0a974ffc1c3d3912a6fec3ae3ad0ca244070cf57f36077e6
0
707
from __future__ import annotations import hashlib import json import logging import re import shutil from datetime import datetime from pathlib import Path from .models import CharacterIdentity, CharacterProfile, VoiceProfile logger = logging.getLogger(__name__) def _slugify(text: str) -> str: """Convert *text...
ai-video
scripts/core/character_store.py
Python
9a30073b95ef2243b936bf48ddb770fd05bd3a6ac14e89132b5f6e869830ea88
0
896
): return characters for entry in sorted(self.characters_dir.iterdir()): identity_file = entry / "identity.json" if entry.is_dir() and identity_file.exists(): try: characters.append(self.load(entry.name)) except Exception as...
ai-video
scripts/core/character_store.py
Python
d02234561004189741109c1fcef4c154d71342a7e876195f9e90d57e5dc64609
1
896
------------------------------------------------- def get_voice_id(self, character_id: str) -> str | None: """Return the cached ElevenLabs voice ID, or ``None``.""" voice_file = self.characters_dir / character_id / "voice" / "voice_id.txt" if voice_file.exists(): return voice_fi...
ai-video
scripts/core/character_store.py
Python
f66cab38df2a1c1c2e8062d2de0226f96cdeec4d706831ee7755b7fed23213ae
2
603
from __future__ import annotations import json import logging from datetime import datetime from pathlib import Path from typing import Any from .models import Checkpoint, CostEntry, ProjectState, StageStatus logger = logging.getLogger(__name__) class CheckpointManager: def __init__(self, project_dir: Path): ...
ai-video
scripts/core/checkpoint.py
Python
9d47fc1b6505d2b3bcadde207ab0a37cba093d0fcaa0363a48cccc0e78e5b58a
0
833
from __future__ import annotations import json import logging import os from pathlib import Path from dotenv import load_dotenv from .models import ProjectConfig logger = logging.getLogger(__name__) _ROOT = Path(__file__).resolve().parent.parent.parent class ConfigManager: def __init__(self, project_dir: Pat...
ai-video
scripts/core/config_manager.py
Python
67dd69c46b66bd37a8654b954b706b0898c79bad77d319d41af295ac628718fd
0
896
-specific keys found. """ keys: list[str] = [] # Try numbered Veo keys first i = 1 while True: key_name = f"VEO_API_KEY_{i}" key_value = os.environ.get(key_name) if not key_value: break keys.append(key_value...
ai-video
scripts/core/config_manager.py
Python
2b4767e943c9207495c0bf318bfc65031e6a805f118ab319df43d997787c0d75
1
111
"""Project-wide constants and defaults. This module centralizes magic numbers and configuration defaults used throughout the AI video pipeline. """ from __future__ import annotations # ============================================================================= # Audio Processing # ==================================...
ai-video
scripts/core/constants.py
Python
4aa061fcbaa990b05019d4981eedb7667b9582e570a76bcbabdc3749a50ab489
0
896
====================================== # Remotion Graphics # ============================================================================= INTRO_DURATION_SECONDS = 5.0 OUTRO_OFFSET_SECONDS = 8.0 CHAPTER_CARD_DURATION_SECONDS = 3.0 LOWER_THIRD_DURATION_SECONDS = 5.0 # ===================================================...
ai-video
scripts/core/constants.py
Python
326b90fe308fe005a69c5ae79f5f4735067c5368d40c1a34d33468b9ce724b35
1
805
from __future__ import annotations from typing import Optional from .edit_plan import EditPlan from .models import CostBreakdown, ProjectConfig PRICING = { "gemini_image": { "gemini-3-pro-image-preview": 0.134, "imagen-4.0-generate-001": 0.030, }, "veo": { "veo-3.1-generate-previe...
ai-video
scripts/core/cost_estimator.py
Python
d87333d71fe4d7ed80b88a22df039d7d1dbde22cb57cca146b3490955bdf4348
0
896
append("\U0001f4a1 Notes:") for note in breakdown.notes: lines.append(f" \u2022 {note}") return "\n".join(lines) def _image_price(self) -> float: return PRICING["gemini_image"].get(self.config.image_model, 0.134) def _estimate_from_edit_plan(self, edit_plan: EditPl...
ai-video
scripts/core/cost_estimator.py
Python
611eb3d67af68b0c228e29e80ef6d745992fcd9a7d4e7c177e76725973a88ad6
1
584
from __future__ import annotations from datetime import datetime from enum import Enum from typing import Optional from pydantic import BaseModel, Field class SegmentType(str, Enum): TALKING_HEAD = "talking_head" BROLL_STOCK = "broll_stock" BROLL_GENERATED = "broll_generated" MOTION_GRAPHIC = "motio...
ai-video
scripts/core/edit_plan.py
Python
cc4d207766f04b447f9bc4d20e441ce06adf4515d0917d3cd8103e531e344180
0
499
from __future__ import annotations from pathlib import Path from typing import Optional from pydantic import BaseModel, Field class LongFormVideoConfig(BaseModel): """Configuration for long-form video generation (10+ minutes).""" # Veo Key Rotation veo_keys: list[str] = Field(default_factory=list) # V...
ai-video
scripts/core/long_form_config.py
Python
4e543b8ec93dc933a32361c16e87b0eba146428c465ddc986a9e17edfeeabe33
0
303
from __future__ import annotations from datetime import datetime from enum import Enum from pathlib import Path from typing import Any, Optional from pydantic import BaseModel, Field class StageStatus(str, Enum): PENDING = "pending" ACTIVE = "active" COMPLETED = "completed" ERROR = "error" SKIPP...
ai-video
scripts/core/models.py
Python
fe5f074b28c40fe956eb11e71af0be452b3497f233a40865c46b04d698f8b31e
0
896
eleven_multilingual_sts_v2" # --- Video provider --- video_provider: str = "veo" # "veo", "replicate", "local" replicate_model_id: str = "" # e.g. "kling/v2.6", "wan-video/wan-2.5-i2v-fast" # --- Video output --- default_aspect_ratio: str = "9:16" default_resolution: str = "1080p" fps: i...
ai-video
scripts/core/models.py
Python
19960d925addc839eec007bde134689109fd7324b23b499a404a8a09649395ad
1
616
from __future__ import annotations import logging from pathlib import Path from .models import CharacterProfile, InputMode, Script, ScriptSegment logger = logging.getLogger(__name__) _ROOT = Path(__file__).resolve().parent.parent.parent _PROMPTS_DIR = _ROOT / "templates" / "prompts" class ScriptEngine: def __...
ai-video
scripts/core/script_engine.py
Python
ba14ba943508a829250d13acb111374ea73cf70f432faac6fd5b13d596c7daac
0
872
from __future__ import annotations import time from pathlib import Path from .models import ProjectState, StageStatus _STAGE_LABELS = { "input_parsing": "Input Parsing", "script_generation": "Script Generation", "character_design": "Character Design", "image_generation": "Image Generation", "fram...
ai-video
scripts/core/status_bar.py
Python
c91baed43f83191ee34ab4403e0f352da6ecd666ed68731b8ae1b0431739e075
0
896
, "Idle") sub = getattr(self, "_sub_progress", "") action_text = f"Current: {action}" if sub: action_text += f" ({sub})" lines.append(self._pad(action_text, width)) lines.append("\u255a" + "\u2550" * width + "\u255d") return "\n".join(lines) def print_st...
ai-video
scripts/core/status_bar.py
Python
cb33ac33a16d670e3962e90e283c73dafb3ed6daaa8103f3a94f52f461e7bf5d
1
203
from __future__ import annotations import json import logging from concurrent.futures import ThreadPoolExecutor, as_completed from dataclasses import dataclass, field from pathlib import Path from google.genai.errors import ClientError from scripts.core.models import ScriptSegment from .video_generator import Video...
ai-video
scripts/generation/batch_generator.py
Python
06843567e0f7bb9bba0b8bb7ac4ca4633f7fe351a3d52f85c727a643ff6baf6e
0
896
, variants: int, ) -> list[Path]: return self.generator.generate_variants( prompt=task.prompt, start_frame=task.start_frame, end_frame=task.end_frame, count=variants, output_dir=output_dir, ) @staticmethod def build_tasks( ...
ai-video
scripts/generation/batch_generator.py
Python
bd1544bda35cf85ad2629091240439c72a9543952bf7b5ad1541f9bcbed82807
1
279
from __future__ import annotations import json import logging from pathlib import Path from google import genai from google.genai import types from scripts.core.models import CharacterIdentity, CharacterProfile logger = logging.getLogger(__name__) _ROOT = Path(__file__).resolve().parent.parent.parent _PROMPTS_DIR ...
ai-video
scripts/generation/character_generator.py
Python
2c626cb905c7917e345a5a5f92e508812bd4097d43bfb41458d97bc2821e3134
0
896
]: output_dir.mkdir(parents=True, exist_ok=True) paths: list[Path] = [] for i, data in enumerate(images): path = output_dir / f"{prefix}_v{i}.png" path.write_bytes(data) paths.append(path) logger.info("Saved %s", path) return paths d...
ai-video
scripts/generation/character_generator.py
Python
d72416e3a749330f34deb8885fd27fd68c52ce0a2cbab3a341aef0e79684da59
1
896
* total references. """ for img in new_images[:max_references]: store.add_reference_image(identity.id, img) # type: ignore[attr-defined] # Reload so reference_images list is up to date updated = store.load(identity.id) # type: ignore[attr-defined] logger.info( ...
ai-video
scripts/generation/character_generator.py
Python
dd8bf50ab1addc3901a881eeeb9b9cde2932b7646e5b37e2c22aeeee30b24c2f
2
108
from __future__ import annotations import json import logging from pathlib import Path from google import genai from google.genai import types from scripts.core.models import CharacterProfile, ScriptSegment logger = logging.getLogger(__name__) _ROOT = Path(__file__).resolve().parent.parent.parent _PROMPTS_DIR = _R...
ai-video
scripts/generation/frame_generator.py
Python
65e6eb5c64a55927ffbc7fd9906e3e99b86162091acaf79046ec635f7f1cc9d8
0
896
json.dumps(metadata, indent=2), encoding="utf-8") return path def _generate_single_frame( self, prompt: str, reference_images: list[bytes] | None = None, aspect_ratio: str = "9:16", attempt: int = 0, ) -> bytes | None: contents: list[types.Part] = [] ...
ai-video
scripts/generation/frame_generator.py
Python
49a18745040df91cd3bbb526157a7755fccbfb62e89b5906e0adf5d4e40977c1
1
356
from __future__ import annotations import logging from concurrent.futures import CancelledError, ThreadPoolExecutor, as_completed from pathlib import Path from google.genai.errors import ClientError from scripts.core.models import CharacterProfile from .frame_generator import FrameGenerator logger = logging.getLog...
ai-video
scripts/generation/parallel_frames.py
Python
9b1473d34337450537379d4104aeaf9237254e8b31bce1b64790eea7c6edbad5
0
896
, e) # ================================================================== # Phase 2: Generate middle frames sequentially with references # ================================================================== if n > 2: logger.info("Phase 2: Generating %d middle frames sequentia...
ai-video
scripts/generation/parallel_frames.py
Python
815f4cff1d1e51f661198a2d6777015136c19b263ff9dccae5de954d733d5f8a
1
896
list[list[bytes]], output_dir: Path, ) -> list[list[Path]]: """Save all frame variants to disk.""" all_paths: list[list[Path]] = [] for idx, variants in enumerate(results): paths = self.frame_gen.save_frames(variants, output_dir, idx) all_paths.append(paths) ...
ai-video
scripts/generation/parallel_frames.py
Python
8597ea5f118110c288e60eeef77c8742b045f0f01676236838d50aa51ad784e3
2
80
from __future__ import annotations import logging from pathlib import Path from scripts.core.models import CharacterProfile, ScriptSegment from scripts.generation.providers.base import VideoProvider from scripts.generation.providers.factory import VideoProviderFactory logger = logging.getLogger(__name__) # -------...
ai-video
scripts/generation/video_generator.py
Python
6636d326b42c6d214ddf5dace19efd649a0654a2479da9adb545478a49204427
0
896
--------------------- environment = character.setting or "a clean, well-lit interior" # --- Technical specs --------------------------------------------------- lighting = character.lighting or "bright, even lighting" # --- Anti-perfection details (naturalness) ----------------------------- anti = ...
ai-video
scripts/generation/video_generator.py
Python
c4c8f07b7700ffca31c9f4d35172609888e0a7b8976a43d870f31c344b37573f
1
896
-> VideoProvider: return self._provider # ------------------------------------------------------------------ # Delegated methods — same signatures as before # ------------------------------------------------------------------ def generate_clip( self, prompt: str, start_...
ai-video
scripts/generation/video_generator.py
Python
cd0efa9092fe649d1232a84fbb8b87bdb7917953a83a12ada60c6456d33db8a1
2
497
from .base import VideoProvider from .factory import VideoProviderFactory __all__ = ["VideoProvider", "VideoProviderFactory"]
ai-video
scripts/generation/providers/__init__.py
Python
0ccbcb17336b7409495e9946331a354a820607ee1b5ee03362d2d2e9f11765b8
0
21
from __future__ import annotations import abc from pathlib import Path class VideoProvider(abc.ABC): """Abstract base class for video generation providers. Each provider wraps a specific API (Veo, Replicate, local endpoint) and exposes a common interface for the pipeline to consume. """ # -----...
ai-video
scripts/generation/providers/base.py
Python
846231b66736c99d8d73d338b532e3f68e563100e2ca561fd8c4f88f21ac9455
0
896
9:16", person_generation: str = "allow_adult", output_dir: Path | None = None, retries: int = 2, ) -> Path | None: """Generate an initial clip then extend it N-1 times. The default implementation raises :class:`NotImplementedError` for providers that do not support e...
ai-video
scripts/generation/providers/base.py
Python
5782878931eb28eb5947ac4842bb64f0688916506491c2df51f110b968603f99
1
425
from __future__ import annotations import logging from .base import VideoProvider logger = logging.getLogger(__name__) class VideoProviderFactory: """Instantiate the correct :class:`VideoProvider` by name.""" @staticmethod def create( provider_name: str, api_key: str, model: st...
ai-video
scripts/generation/providers/factory.py
Python
37b368c52a8ca6076a7ed05fc26deec34e25f60611b3830a36e75627a023e065
0
335
from __future__ import annotations import base64 import logging import time from pathlib import Path from uuid import uuid4 import requests from .base import VideoProvider logger = logging.getLogger(__name__) # Default polling settings for Replicate predictions _POLL_INTERVAL = 5 _MAX_POLL_SECONDS = 600 # 10 minu...
ai-video
scripts/generation/providers/replicate_provider.py
Python
18e03454a2e9f9eec84d1f5038db7a2ad37e34ab68248b443f6fa1290cab7c43
0
896
----------------------------- # Capability flags # ------------------------------------------------------------------ @property def name(self) -> str: return f"Replicate ({self.model_id})" @property def supports_extension(self) -> bool: return False # Replicate models generall...
ai-video
scripts/generation/providers/replicate_provider.py
Python
15e02814824ba18aebb38310e28cb99de759987ce7251d123eaaae16a0bf653a
1
896
prediction: object) -> str | None: """Poll a Replicate prediction until it completes or fails. Returns the output URL string, or ``None``. """ deadline = time.time() + _MAX_POLL_SECONDS while time.time() < deadline: prediction.reload() status = predictio...
ai-video
scripts/generation/providers/replicate_provider.py
Python
2bf87513802f810aaa6c0a13806438383710e8d857bef17078e8c3a700e71ee8
2
421
from __future__ import annotations import logging import time from pathlib import Path from typing import Optional from uuid import uuid4 from google import genai from google.genai import types from google.genai.errors import ClientError from .base import VideoProvider from scripts.core.constants import ( VEO_PO...
ai-video
scripts/generation/providers/veo.py
Python
c4b208da386e39a7b9cf915fc09f1134e8d115e68d5d5a9ad2ba10158f3d0594
0
896
jpeg", ) config = types.GenerateVideosConfig( aspect_ratio=aspect_ratio, person_generation=person_generation, ) kwargs: dict = { "model": self.model, "prompt": prompt, "image": start_image, "config": config, ...
ai-video
scripts/generation/providers/veo.py
Python
984eea2e3131f1454828d9e44818177a4c9756b7152f17b5591ee964e6157945
1
896
< retries: self._current_client = None continue else: backoff = VEO_RATE_LIMIT_BACKOFF[ min(attempt, len(VEO_RATE_LIMIT_BACKOFF) - 1) ] logger.w...
ai-video
scripts/generation/providers/veo.py
Python
e2e0f5e8e17745b2d99043f3d7d1f627820c016867cf858b8ad8a406146d31da
2
896
, retrying in 10s...") time.sleep(10) if not initial_path: logger.error("Extension chain: initial clip generation failed") return None if len(prompts) == 1: return initial_path # --- Steps 2..N: extend for each subsequent segment --- ...
ai-video
scripts/generation/providers/veo.py
Python
8220f36e724c7544e62c0a4c8fb56ebe4a65d0ca6cf828c0fc262cd62a71ffe6
3
756
from .remotion_renderer import RemotionRenderer __all__ = ["RemotionRenderer"]
ai-video
scripts/graphics/__init__.py
Python
e0c865db8a68eca43ceba771877302ae1a70a39afd53cf24e02dfdd61868d3ef
0
12
from __future__ import annotations import hashlib import json import logging import shutil import subprocess from pathlib import Path from typing import Optional from scripts.core.constants import ( INTRO_DURATION_SECONDS, OUTRO_OFFSET_SECONDS, CHAPTER_CARD_DURATION_SECONDS, LOWER_THIRD_DURATION_SECON...
ai-video
scripts/graphics/remotion_renderer.py
Python
77190ad1a133ecb25b66288add8b2a31c760bbfc1b3b713ff3bb93052b29de43
0
896
%s", composition, e) return None return None def _build_props( self, edit_plan: EditPlan, character: CharacterProfile, total_duration: float, ) -> dict: """Build props JSON for Remotion.""" # Extract character name from profile or use default...
ai-video
scripts/graphics/remotion_renderer.py
Python
265ab540911e58b98f7c22bd7f12f2983b0ba991f90dd160487bf1807348cbb8
1
673
from __future__ import annotations import json import logging import re from pathlib import Path from scripts.core.models import Script, ScriptSegment from scripts.core.constants import ( DEFAULT_WORDS_PER_MINUTE, SEGMENT_CORRUPTION_THRESHOLD, ) logger = logging.getLogger(__name__) _SEGMENT_PATTERN = re.com...
ai-video
scripts/input/script_parser.py
Python
b81ebabe8a74ca89212d645f1c72ad760844208c77d0d23d528132337f96d2a3
0
896
. Args: word_count: Number of words in the segment fallback: Duration to return if word_count is 0 Returns: Duration in seconds, clamped between 3.0 and 25.0 seconds """ if word_count == 0: return fallback dura...
ai-video
scripts/input/script_parser.py
Python
263d75806b2aecd728e39ac773056315005abbbf265686b6345903d678f52c71
1
896
=language, segments=segments) def _parse_freeform(self, text: str, language: str) -> Script: sentences = self._split_sentences(text) segments: list[ScriptSegment] = [] current_text: list[str] = [] current_words = 0 target_words = 25 if language.startswith("en") else 22 ...
ai-video
scripts/input/script_parser.py
Python
a180f75e49b2592cbbe577232512d40aa20781f412abbd53391571e20b1d3470
2
625
from __future__ import annotations import json import logging from pathlib import Path from elevenlabs import ElevenLabs from scripts.core.models import Script, ScriptSegment logger = logging.getLogger(__name__) class TranscriptExtractor: def __init__(self, api_key: str): self.client = ElevenLabs(api_...
ai-video
scripts/input/transcript_extractor.py
Python
f9c88251425b02f7906ddebfb42f5f692a12e4c289f6b3494516cb1a9eef30db
0
896
?])\s+', text) segments: list[ScriptSegment] = [] current: list[str] = [] seg_id = 1 target_words = 25 for sentence in sentences: word_count = len(sentence.split()) current_count = sum(len(s.split()) for s in current) if current_count + word_...
ai-video
scripts/input/transcript_extractor.py
Python
b0b2377fcf43b545bf00b6a250b465bb3dbf977b52791537c5e32ee492b5714b
1
157
from __future__ import annotations import json import logging import subprocess from pathlib import Path logger = logging.getLogger(__name__) class YouTubeAnalyzer: def __init__(self, output_dir: Path): self.output_dir = output_dir self.output_dir.mkdir(parents=True, exist_ok=True) def down...
ai-video
scripts/input/youtube_analyzer.py
Python
0bd3615a362768dd02ef28a3dd20672ff53bb6d706138713084c3bf4eaae7948
0
896
.run(cmd, check=True, capture_output=True) paths.append(out) return paths def build_source_analysis(self, metadata: dict, scenes: list[dict]) -> dict: duration = float(metadata.get("duration", 0)) title = metadata.get("title", "") description = metadata.get("description...
ai-video
scripts/input/youtube_analyzer.py
Python
c61b0c2a374861f104d5dcf6ced68280154fdfa2868941084fec5b070f337efd
1
267
from __future__ import annotations import concurrent.futures import logging from concurrent.futures import ThreadPoolExecutor, as_completed from pathlib import Path from typing import Any from scripts.core.checkpoint import CheckpointManager from scripts.core.constants import DEFAULT_WORKSTREAM_TIMEOUT from scripts.c...
ai-video
scripts/orchestration/parallel_workstream.py
Python
87d33a452abaf69bd7817fafb62891a9a690253c5d314638c414d16c0f5b87f0
0
896
, project_dir: Path, ) -> dict[str, Any]: """Workstream 7c: Render motion graphics.""" logger.info("Workstream: Rendering motion graphics") # Placeholder - actual implementation would use RemotionRenderer return {"outputs": [], "status": "completed"} def _generate_voice_...
ai-video
scripts/orchestration/parallel_workstream.py
Python
bb47278a1997dbf22a17edfdadf103ff4c608ed1c6dced6fccbb9cd8960419fc
1
222
from .edit_plan_generator import EditPlanGenerator __all__ = ["EditPlanGenerator"]
ai-video
scripts/planning/__init__.py
Python
bc43b3c3e92e18efe95d04fceb98b3e40005786bb39db0dc85e25b75d1b49924
0
12
from __future__ import annotations import json import logging import re import time from pathlib import Path from scripts.core.constants import ( DEFAULT_VEO_COST_PER_CALL, BROLL_MIN_DURATION_SECONDS, BROLL_MAX_DURATION_SECONDS, BROLL_DURATION_FACTOR, ) from scripts.core.edit_plan import EditPlan from...
ai-video
scripts/planning/edit_plan_generator.py
Python
0e43e000309ff07ead892b332291e3f6833e2c109d586d9fe3c20f3d0b5e9b38
0
896
{script.title}", f"Language: {script.language}", ""] for seg in script.segments: lines.append(f"Segment {seg.id}: {seg.text}") if seg.action: lines.append(f" Action: {seg.action}") if seg.emotion: lines.append(f" Emotion: {seg.emotion}") ...
ai-video
scripts/planning/edit_plan_generator.py
Python
acb5835df3bf90491cf26552832481dba92abd00aa1f69d75c06c3f59852d95a
1
896
).strip() # Classify as stock vs generated is_stock = any(keyword in broll_text for keyword in STOCK_KEYWORDS) or len(broll_text.split()) <= 2 seg_type = SegmentType.BROLL_STOCK if is_stock else SegmentType.BROLL_GENERATED ...
ai-video
scripts/planning/edit_plan_generator.py
Python
6e4dfdb873f4df93406f54559317041ed159dbe9cbbda1c1adf6932044e8c536
2
730
from .veo_key_manager import VeoKeyRotationManager, VeoKeyState __all__ = ["VeoKeyRotationManager", "VeoKeyState"]
ai-video
scripts/providers/__init__.py
Python
529c0da70fd7cd13589a48566b95669d4ca1c37348ddff35e104de4e0cebfb3d
0
18
from __future__ import annotations import hashlib import json import logging import threading from datetime import datetime, timedelta from pathlib import Path from typing import Optional from pydantic import BaseModel, Field logger = logging.getLogger(__name__) class VeoKeyState(BaseModel): """State tracking ...
ai-video
scripts/providers/veo_key_manager.py
Python
d91dfbf61cf199a38ca9062f3209ebded4b6f43aefee502a36523abc943adb69
0
896
None ) -> None: """Mark a request as rate limited (429).""" with self._lock: key_state = self._find_key(api_key) if key_state: key_state.in_flight_count = max(0, key_state.in_flight_count - 1) if retry_after: key_state.rate_...
ai-video
scripts/providers/veo_key_manager.py
Python
94e453f361295b5f911a985aef4a0c147310d2aa8338d1fa29cf4be4a5fa3ea3
1
896
: logger.warning("Failed to load persisted key state: %s", e) def _persist_state(self) -> None: """Persist key state to disk.""" try: data = { "keys": [ { "key_id": k.key_id, "usage_count": k...
ai-video
scripts/providers/veo_key_manager.py
Python
bc12de4014dc6e01eb37452ff704318e0e4a1aeb5042d8b0174f647723087143
2
282
from __future__ import annotations import logging import subprocess from pathlib import Path import numpy as np from PIL import Image logger = logging.getLogger(__name__) FRAMES_TO_CHECK = 10 class ArtifactDetector: def detect(self, clip_path: Path, work_dir: Path) -> list[dict]: frames = self._extrac...
ai-video
scripts/qa/artifact_detector.py
Python
2d176d882a5ab5038ee8ff3ec88e9469dd846d10a3ffcf7e5146aa848574a8d3
0
896
count)}))", "-frames:v", str(count), "-vsync", "vfr", str(output_dir / "frame_%03d.png"), ] subprocess.run(cmd, check=True, capture_output=True) return sorted(output_dir.glob("frame_*.png"))
ai-video
scripts/qa/artifact_detector.py
Python
2b2f3f4c56a65cea96ba0088dad171e647e2215f2526796da87c2cc31c249bde
1
72
from __future__ import annotations import logging import subprocess from pathlib import Path import numpy as np from scripts.core.constants import AUDIO_SYNC_TOLERANCE_MS logger = logging.getLogger(__name__) class AudioSyncChecker: @staticmethod def check_sync( video_path: Path, audio_path...
ai-video
scripts/qa/audio_sync_check.py
Python
769bf9bd588b666a5a620e513d18ddfa5016d8d41420991f0d4bf3912e9f3b32
0
737
from __future__ import annotations import json import logging import subprocess from datetime import datetime from pathlib import Path from .artifact_detector import ArtifactDetector from .audio_sync_check import AudioSyncChecker from .visual_consistency import VisualConsistencyChecker from scripts.core.constants imp...
ai-video
scripts/qa/full_qa_report.py
Python
01feb6f12375b9da12301475ec629750bfdd17579d63ec7b4e2d0edb789404d6
0
896
("checks", {}).items(): if not isinstance(check, dict): continue score = check.get("score", "N/A") label = name.replace("_", " ").title() icon = "\u2705" if (isinstance(score, (int, float)) and score >= 0.8) else "\u26a0\ufe0f" if isinstance(sc...
ai-video
scripts/qa/full_qa_report.py
Python
747a8ff7b3fde5bc630ce0dce93577328dce1b695e9a800a9d226406b94f8abc
1
896
result.stdout.strip()) durations.append(d) total += d except subprocess.CalledProcessError: durations.append(0.0) except ValueError: durations.append(0.0) return { "total_seconds": round(total, 2), "...
ai-video
scripts/qa/full_qa_report.py
Python
c672563c6ba2b7fe85f849bed123a82a8f9102f82b29184f841269615d85bd42
2
84
from __future__ import annotations import logging import subprocess from pathlib import Path import imagehash import numpy as np from PIL import Image logger = logging.getLogger(__name__) class VisualConsistencyChecker: @staticmethod def extract_boundary_frames( clip_paths: list[Path], outp...
ai-video
scripts/qa/visual_consistency.py
Python
a4f1871254911f6a9938397583af355c4563d436b79b5edc24d87bcd16a3976b
0
896
str(clip), ] result = subprocess.run(cmd, capture_output=True, text=True, check=True) w, h = result.stdout.strip().split(",") resolutions.append((int(w), int(h))) unique = set(resolutions) consistent = len(unique) == 1 return { "consi...
ai-video
scripts/qa/visual_consistency.py
Python
74d78281a32253a485d643347c9f28c39118f47201241880f9b6c6707ac395f5
1
150
from .asset_cache import AssetCache from .broll_sourcer import BRollSourcer from .pexels_client import PexelsClient __all__ = ["AssetCache", "BRollSourcer", "PexelsClient"]
ai-video
scripts/sourcing/__init__.py
Python
9124885797ad06db1ca39c70af6be78f222beab34528d81a7de1f2d7119dcf2b
0
30
from __future__ import annotations import hashlib import json import logging import shutil from pathlib import Path from typing import Optional import numpy as np from sentence_transformers import SentenceTransformer logger = logging.getLogger(__name__) class AssetCache: """Semantic cache for b-roll assets wit...
ai-video
scripts/sourcing/asset_cache.py
Python
91e8af3e6ea39d97c8de24d494a3ca1f195898ff44fda879adaf228ad9104999
0
896
= None for i, meta in enumerate(self.metadata): if meta.get("file_path") == str(cached_path): existing_idx = i break if existing_idx is not None: self.metadata[existing_idx] = asset_meta else: self.metadata.append(asset_meta) ...
ai-video
scripts/sourcing/asset_cache.py
Python
05042aa414efeb103e76c12b3913dfdf7c21b0b7fc0f59a2f1b55053c148c7db
1
366
from __future__ import annotations import logging from pathlib import Path from typing import Optional, Tuple from scripts.core.constants import CLIP_DURATION_MATCH_THRESHOLD from scripts.core.edit_plan import EditPlanSegment, SegmentType from scripts.generation.providers.veo import VeoProvider from .asset_cache imp...
ai-video
scripts/sourcing/broll_sourcer.py
Python
128b400339a83836f970a83edb1df5cce3610b3b283fc4624d7bf5c97dae7150
0
896
":")) return "landscape" if w > h else "portrait" return "landscape" @staticmethod def _build_veo_prompt(segment: EditPlanSegment) -> str: """Build Veo prompt from segment.""" parts = [segment.visual_description] if segment.broll_keywords: parts.append("K...
ai-video
scripts/sourcing/broll_sourcer.py
Python
3cecc3b4b3b9588433a559e51ebb8f68f2c8142afaad3fc4309db8e0ac5a2e37
1
87
from __future__ import annotations import logging import time from pathlib import Path from typing import Optional from urllib.parse import urlencode import requests logger = logging.getLogger(__name__) PEXELS_API_BASE = "https://api.pexels.com/videos" PEXELS_RATE_LIMIT = 200 # requests per hour (free tier) PEXELS...
ai-video
scripts/sourcing/pexels_client.py
Python
ea3251ff988622b1cb0eeaef277a970bf799f5261df7bb37ae01cf66621bbcd0
0
896
(key=lambda x: x["score"], reverse=True) return scored def _get_best_video_url(self, video: dict) -> Optional[str]: """Get best quality video URL from video object.""" video_files = video.get("video_files", []) if not video_files: return None # Prefer HD (1080p)...
ai-video
scripts/sourcing/pexels_client.py
Python
17ba4b34e8d7a5382cfb4a0eda4e6b13ddc8ae02e6950f8d656e11d9fbff439c
1
509
from .subtitle_burner import SubtitleBurner from .subtitle_generator import SubtitleGenerator __all__ = ["SubtitleGenerator", "SubtitleBurner"]
ai-video
scripts/subtitles/__init__.py
Python
cf1a656bddc8c0cc9b39e61c989efde51ae3647d74738fb7a4548a183925f110
0
21
from __future__ import annotations import logging import subprocess from pathlib import Path logger = logging.getLogger(__name__) class SubtitleBurner: """Burn subtitles into video using FFmpeg.""" @staticmethod def burn_subtitles( video_path: Path, srt_path: Path, output_path: ...
ai-video
scripts/subtitles/subtitle_burner.py
Python
f5c8836704e621d84982c5a4ed8cf1904886be1d5e292a934026e14918a095e1
0
372
from __future__ import annotations import logging from pathlib import Path from typing import Optional logger = logging.getLogger(__name__) class SubtitleGenerator: """Generate subtitles using Whisper.""" def __init__(self, model_size: str = "base"): """Initialize subtitle generator. ...
ai-video
scripts/subtitles/subtitle_generator.py
Python
c9ee92107d50eb91c59e09029d026bafcc91cdcc6bd2fc1010bba6669c99d83e
0
804
{ "id": "english-presenter", "name": "English Presenter", "language": "en-US", "tags": ["presenter", "male", "tech", "english", "professional"], "character": { "age_range": "25-35", "gender": "male", "style": "smart casual, clean background, tech YouTuber aesthetic", "setting": "home office, m...
ai-video
templates/presets/english-presenter.json
JSON
64e115831e3f949774cfbeb6df69c560e71cfa3b4b1820de8be8ce357caa089e
0
241
{ "id": "german-vlogger", "name": "German Vlogger", "language": "de-DE", "tags": ["vlogger", "female", "young", "german", "casual"], "character": { "age_range": "18-25", "gender": "female", "style": "casual, Gen-Z, streetwear or cozy", "setting": "bedroom or living room, slightly messy", "...
ai-video
templates/presets/german-vlogger.json
JSON
8403b0cb350267782bcc5cc18ad1816b97c59a55dad866e9ff42d49c5078a805
0
244
{ "id": "storyteller", "name": "Storyteller", "language": "en-US", "tags": ["storyteller", "female", "warm", "english", "intimate"], "character": { "age_range": "30-45", "gender": "female", "style": "warm, approachable, cozy sweater or blouse", "setting": "cozy living room, warm lighting, book...
ai-video
templates/presets/storyteller.json
JSON
677abd6d86b02fd9fd3cb0ec7719cbe6c77cf5b4a4cf08ab41fb2ffe49d3c0c7
0
242
Anti-perfection rules for realistic AI-generated content. The goal is to make generated images and videos look like they were captured by a real person with a phone camera, NOT like professional studio content or obvious AI art. ALWAYS include these elements in image/video prompts: Skin & Face: - "natural skin textu...
ai-video
templates/prompts/anti-perfection.md
Markdown
66345e99ef61bf47d7a7100911ef3a99bdfbd57cb1bf1644256892ad14b90388
0
284
You are a professional video editor specializing in YouTube long-form content. Analyze the provided script and create a detailed edit plan following YouTube retention best practices. SCRIPT: {script_text} CHARACTER PROFILE: {character_summary} TARGET DURATION: {target_duration} seconds REQUIREMENTS: 1. Hook: Ensure...
ai-video
templates/prompts/edit-plan-generator.md
Markdown
dc3100d7d16e2f8778a809ccc2f32dba9b5cb2607683e807acf32da4c9f61169
0
238
You are planning a sequence of {num_frames} key frames for a {duration}-second talking-head video. These frames will be used as start/end frames for AI video generation (Veo 3.1). Adjacent video clips share frames: Clip 1 uses Frame A→B, Clip 2 uses Frame B→C, etc. Character description: {character_description} Scri...
ai-video
templates/prompts/frame-planner.md
Markdown
a1f35f60d078aa1cc19233a76b02b4813af2916ebe4f983ec1107669e1ddb2b7
0
260
Analyze this reference image and extract a detailed JSON descriptor of the person shown. Focus on characteristics that can be reproduced consistently across multiple AI-generated images. Extract the following attributes: { "physical": { "age_apparent": "estimated age range", "gender_presentation": "how they...
ai-video
templates/prompts/image-analyzer.md
Markdown
e59a97561ce5177571c41d93914ac497c674c93656f6f0f7daac883fb92f9f2a
0
371
You are adapting a video transcript from {source_language} to {target_language}. Rules: - Do NOT literally translate. Adapt for natural speech in the target language. - Preserve the tone, pacing, and energy level. - Preserve filler words but use target-language equivalents. - Preserve humor — adapt jokes to work in ta...
ai-video
templates/prompts/script-adapter.md
Markdown
069605321f16d6fdbcb725426bd43b43efe67fd6f980cdb71423bd8121c65a2d
0
178
You are a script writer for AI-generated talking-head videos. Your scripts must sound like natural, spontaneous speech — NOT written prose read aloud. Rules: - Include filler words naturally: "ähm", "also", "irgendwie", "na ja" (German) or "um", "like", "you know", "so" (English) - Vary sentence length. Mix short punc...
ai-video
templates/prompts/script-writer.md
Markdown
aad11318baff78a6e67ecdc9095fc98c7998083377b633457853f84b70a8c798
0
896
you know how ice floats, right? Like, in your drink, in a lake… it just… bobs there on top. But have you ever really stopped to think why?" Action: (Leans slightly forward, gestures inquisitively) Emotion: (Engaging, curious, slightly playful) Camera: Medium close-up, slight push in word_count: 30 duration_seconds: 13....
ai-video
templates/prompts/script-writer.md
Markdown
ad7da8cca61384272847d801b21c1e92b25b6e64a64b62c1e2fd24e65041ffa0
1
88
You are writing prompts for Veo 3.1 video generation. Each prompt describes an 8-second video clip of a talking-head character transitioning from one pose/expression to another. You will receive: - Start frame description (the first frame of this clip) - End frame description (the last frame of this clip) - Script seg...
ai-video
templates/prompts/veo-prompt-writer.md
Markdown
31759bd7c208d03d962b6539579beafd4ec13ecda1255e04421f2ab8f38175b7
0
271
{ "name": "ai-video-editor", "version": "1.0.0", "private": true, "scripts": { "start": "npx remotion studio", "build": "npx remotion render VideoAssembly out/video.mp4", "upgrade": "npx remotion upgrade" }, "dependencies": { "@remotion/cli": "^4.0.0", "@remotion/player": "^4.0.0", "...
ai-video
templates/remotion-project/package.json
JSON
94e2b9e88eeb125c1941dbd59731f2d867425fb4cb2418952966f8796a391157
0
196
import { Config } from "@remotion/cli/config"; Config.setVideoImageFormat("jpeg"); Config.setOverwriteOutput(true);
ai-video
templates/remotion-project/remotion.config.ts
TypeScript
38e9e6394e32f151e454efdeb84da8bcc616da7550bc8ef52e1721a001745394
0
30
{ "compilerOptions": { "target": "ES2022", "module": "ES2022", "moduleResolution": "bundler", "jsx": "react-jsx", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "declaration": true, "declar...
ai-video
templates/remotion-project/tsconfig.json
JSON
a81856ef1c06f621deef2debb0e6dfef6443460cbfbc3fe3ff728369fd2d2349
0
138
import { Composition } from "remotion"; import { VideoAssembly } from "./compositions/VideoAssembly"; import { VideoAssemblySchema } from "./lib/props-schema"; import { calculateTotalDuration } from "./lib/timing"; const defaultProps = { segments: [ { src: "/segments/segment_01.mp4", durationFrames: ...
ai-video
templates/remotion-project/src/Root.tsx
TypeScript
e612e75f3e799be300270fad37153c05f399a9aab483f9588f253c7d8f626948
0
202
import React from "react"; import { AbsoluteFill, Img, useCurrentFrame, useVideoConfig, interpolate, } from "remotion"; interface KenBurnsEffectProps { src: string; zoomStart: number; zoomEnd: number; panX: number; panY: number; } export const KenBurnsEffect: React.FC<KenBurnsEffectProps> = ({ s...
ai-video
templates/remotion-project/src/components/KenBurnsEffect.tsx
TypeScript
7bbcd15b296ab236c02fb12b4b2bd295f6bda8ccc0a0fd90a18936db95850eda
0
262
import React from "react"; import { AbsoluteFill, useCurrentFrame, interpolate } from "remotion"; interface TransitionEffectProps { type: "crossDissolve" | "fade"; durationFrames: number; children: React.ReactNode; } export const TransitionEffect: React.FC<TransitionEffectProps> = ({ type, durationFrames, ...
ai-video
templates/remotion-project/src/components/TransitionEffect.tsx
TypeScript
7f350112ec2df18c364261f28dcba98c3929188b733be3f92071561c6b10b736
0
164
import React from "react"; import { Audio, Sequence } from "remotion"; interface AudioTrack { src: string; startFrame: number; volume: number; } interface AudioLayerProps { tracks: AudioTrack[]; } export const AudioLayer: React.FC<AudioLayerProps> = ({ tracks }) => { return ( <> {tracks.map((trac...
ai-video
templates/remotion-project/src/compositions/AudioLayer.tsx
TypeScript
4aef8c84e16b2be5e84d0f026cc60f79618c5b979d1178e651a85cf7e92d212a
0
127
import React from "react"; import { AbsoluteFill, OffthreadVideo } from "remotion"; interface ClipSequenceProps { src: string; trimStartFrames: number; trimEndFrames: number; durationFrames: number; } export const ClipSequence: React.FC<ClipSequenceProps> = ({ src, trimStartFrames, trimEndFrames, dura...
ai-video
templates/remotion-project/src/compositions/ClipSequence.tsx
TypeScript
0f9b7e334a06e0fd6df5392611e0e28a256a938ca693dcc1fbc5ab2f3de6289d
0
123