-
-
Notifications
You must be signed in to change notification settings - Fork 36
Google Colab Guide
Muhammad Naufal Rizqullah edited this page Jun 26, 2026
·
1 revision
If you don't have a local GPU, Google Colab provides free access to NVIDIA T4 GPUs — perfect for running the full pipeline.
Open a new Google Colab notebook and set the Runtime to T4 GPU.
!rm -rf ./* ./.*
!git clone https://github.com/NaufalRizqullah/opensource-clipping.git .
!pip install -r requirements.txtimport os
from pathlib import Path
from google.colab import userdata
# Store your keys in Colab Secrets first (key icon in sidebar)
GOOGLE_API_KEY = userdata.get("GOOGLE_API_KEY")
env_text = f"GOOGLE_API_KEY={GOOGLE_API_KEY}\n"
Path(".env").write_text(env_text, encoding="utf-8")Tip: Click the 🔑 (Secrets) icon in the Colab sidebar to add your API keys securely.
URL_YOUTUBE = "https://www.youtube.com/watch?v=YOUR_VIDEO_ID"
JUMLAH_CLIP = 7
RASIO = "9:16"
FONT_STYLE = "DEFAULT"
GEMINI_MODEL = "gemini-3-flash-preview"
!python main.py \
--url "{URL_YOUTUBE}" \
--clips {JUMLAH_CLIP} \
--ratio "{RASIO}" \
--font-style "{FONT_STYLE}" \
--hook-duration 3 \
--words-per-sub 5 \
--gemini-model "{GEMINI_MODEL}" \
--no-bgmURL_YOUTUBE = "https://www.youtube.com/watch?v=VIDEO_ID"
JUMLAH_CLIP = 7
RASIO = "9:16"
FONT_STYLE = "DEFAULT"
GEMINI_MODEL = "gemini-2.0-flash"
!python main.py \
--url "{URL_YOUTUBE}" \
--clips {JUMLAH_CLIP} \
--ratio "{RASIO}" \
--font-style "{FONT_STYLE}" \
--hook-duration 3 \
--words-per-sub 5 \
--face-detector yolo \
--gemini-model "{GEMINI_MODEL}" \
--no-bgm \
--no-subs \
--no-broll \
--use-dlp-subsURL_YOUTUBE = "https://www.youtube.com/watch?v=PODCAST_ID"
JUMLAH_CLIP = 3
RASIO = "9:16"
FONT_STYLE = "DEFAULT"
GEMINI_MODEL = "gemini-2.0-flash"
!python main.py \
--url "{URL_YOUTUBE}" \
--clips {JUMLAH_CLIP} \
--ratio "{RASIO}" \
--font-style "{FONT_STYLE}" \
--hook-duration 3 \
--words-per-sub 5 \
--gemini-model "{GEMINI_MODEL}" \
--no-bgm \
--no-subs \
--no-broll \
--split-screen \
--dynamic-split \
--split-trigger face \
--face-detector yolo \
--use-dlp-subsWhen running on Kaggle (which has limited T4 configurations), use float32 for Whisper:
WHISPER_COMPUTE_TYPE = "float32"
!python main.py \
--url "{URL_YOUTUBE}" \
--clips 5 \
--whisper-compute-type "{WHISPER_COMPUTE_TYPE}" \
--no-bgmTo enable more features, add additional secrets:
from google.colab import userdata
GOOGLE_API_KEY = userdata.get("GOOGLE_API_KEY")
PEXELS_API_KEY = userdata.get("PEXELS_API_KEY") # For B-roll
HF_TOKEN = userdata.get("HF_TOKEN") # For podcast modes
env_text = f"""GOOGLE_API_KEY={GOOGLE_API_KEY}
PEXELS_API_KEY={PEXELS_API_KEY}
HF_TOKEN={HF_TOKEN}
"""
Path(".env").write_text(env_text, encoding="utf-8")After rendering, download the generated clips:
# Download all clips from outputs
from google.colab import files
import glob
for f in glob.glob("outputs/**/highlight_*_ready.mp4", recursive=True):
files.download(f)Or zip everything:
!zip -r results.zip outputs/
files.download("results.zip")- Runtime Timeout: Free Colab sessions disconnect after ~90 minutes of inactivity. Keep the browser tab active.
-
GPU Memory: If you run out of GPU memory, try using
--whisper-model mediuminstead oflarge-v3. -
Persistent Storage: Use Google Drive to save outputs across sessions:
from google.colab import drive drive.mount('/content/drive') # Then copy outputs to Drive !cp -r outputs/ /content/drive/MyDrive/clipping_results/
-
Ready-to-use Notebook: Check
notebooks/Lib_OpenSource_Clipping.ipynbin the repo for a pre-configured template.
- Getting Started — Local installation
- Video Quality & Rendering — Quality tuning for Colab