Video generation — Sora-শ্রেণীর মডেল
এই পাঠে যা শিখবেন
- Video data কত বড় — কেন training/inference image-এর তুলনায় কঠিন
- Spacetime patch — Sora-র key innovation
- Latent video diffusion (Make-A-Video, Imagen Video, VDM) architecture
- Open-source video model দিয়ে hands-on — Colab-এ চালানোর কোড
১ · Video কত বড়?
একটি ছবি $1024 \times 1024 \times 3 \approx 3$M float। একটি ১০-সেকেন্ড ভিডিও @ ২৪ fps @ 720p — $240 \times 720 \times 1280 \times 3 \approx 660$M float। $250 \times$ image-এর computational burden। তাই vanilla pixel-space diffusion impossible — latent space ও clever architecture চাই।
২ · Make-A-Video, Imagen Video — early approach
- Video Diffusion Models (VDM, Ho 2022): 3D U-Net — spatial conv + temporal attention।
- Make-A-Video (Meta 2022): pretrained T2I model + temporal layers। কোনো paired text-video supervision লাগে না।
- Imagen Video (Google 2022): cascaded diffusion — low-res video → super-resolution stages।
৩ · Sora (OpenAI Feb 2024) — paradigm shift
Sora-র core idea — "spacetime patchesSpacetime patchesVideo latent-কে $t \times h \times w$ ছোট cube-এ ভাগ। ViT-এর spatial patch-এর 3D extension। Sora এই patch sequence transformer-এ feed করে।"। ViT-এর মতো image patch করে token বানানো — video-এ একই, কিন্তু time axis-এও।
Pipeline:
- Visual encoder — video → latent space (compressed both spatially ও temporally)।
- Latent → spacetime patches (যেমন $1 \times 16 \times 16$ pixel block per latent)।
- Patches = token sequence → Diffusion Transformer (DiT, Peebles 2023)।
- DiT noise predict → progressive denoising।
- Decoder → video frames।
১) Resolution & duration agnostic: patches arbitrary size handle।
২) Native variable aspect ratio: 9:16, 16:9, 1:1 — সব train।
৩) Scale = better: compute বাড়ালে quality monotonically উন্নতি — LLM-এর scaling law।
৪) Emergent capability: 3D coherence, object permanence, long-range consistency।
৪ · Temporal consistency — সবচেয়ে কঠিন সমস্যা
একটি বিড়াল frame ১-এ গরিয়ে frame ৩০-এ ভিন্ন বিড়াল হয়ে গেলে — useless। Models কীভাবে handle করে:
- Cross-frame attention: প্রতিটি frame আগের frames দেখে।
- 3D conv: kernel time axis-এও span।
- Temporal positional embedding।
- Latent compression: high-level feature consistent থাকে; pixel-level wobble OK।
৫ · বর্তমান landscape (২০২৪-২০২৫)
- Sora: OpenAI। ২০-সেকেন্ড 1080p। সবচেয়ে coherent physics।
- Veo 3 (Google 2024): audio সহ video — synchronized speech & sfx।
- Kling (Kuaishou): চীনা — Sora-র closest competitor।
- Wan (Alibaba 2024): open weights! চমৎকার Chinese-text rendering।
- Runway Gen-3, Pika 1.5, Luma Dream Machine: creator-friendly UI।
- Open-source: Mochi 1 (Genmo), CogVideoX (THUDM), HunyuanVideo (Tencent), LTX Video — Colab-friendly।
৬ · CogVideoX দিয়ে hands-on
# pip install -U diffusers transformers accelerate imageio
import torch
from diffusers import CogVideoXPipeline
from diffusers.utils import export_to_video
pipe = CogVideoXPipeline.from_pretrained(
"THUDM/CogVideoX-2b",
torch_dtype=torch.float16,
).to("cuda")
pipe.enable_model_cpu_offload() # VRAM save
prompt = (
"A cinematic shot of cycle rickshaws moving through "
"rainy old Dhaka at dusk, neon shop signs glowing, "
"warm street light reflections on wet road."
)
video = pipe(
prompt=prompt,
num_videos_per_prompt=1,
num_inference_steps=50,
num_frames=49, # ~6 sec @ 8 fps
guidance_scale=6.0,
generator=torch.Generator(device="cuda").manual_seed(42),
).frames[0]
export_to_video(video, "dhaka_rickshaw.mp4", fps=8)
print("✅ saved dhaka_rickshaw.mp4")
ভাবনার প্রশ্ন
প্র ০১ Sora-র "world model" claim — OpenAI বলেছে এটি physics শেখে। সত্যিই কি তাই, না shallow pattern matching? Yann LeCun-এর critique কী?
Sora launch-এ OpenAI-র Bill Peebles বলেছেন — "Sora can be a foundation for models that understand and simulate the real world"। বিতর্কিত claim।
OpenAI-র যুক্তি:
- Object permanence — frame-জুড়ে বস্তু একই থাকে।
- 3D consistency — camera motion-এ scene physically plausible।
- Causality — পাত্র ভাঙলে টুকরো নিচে পড়ে।
- Long-range coherence — minute-scale narrative।
Yann LeCun (Meta Chief Scientist) critique:
- "Generating realistic video doesn't mean understanding physics."
- একটি painter ফোটোগ্রাফিক বাস্তবতা আঁকতে পারে — সে physics বুঝে এমন বলা যায় না।
- True world model = predict & plan। Sora generate করে; predict counterfactual করে কি?
- LeCun-এর alternative — JEPA (Joint Embedding Predictive Architecture)।
Failure modes:
- Sora demo-এ glass shatter wrong — pieces আকাশে।
- Hands ৬টি আঙুল।
- Walking person leg switch।
- Object বদলে যায় occlusion-এর পর।
Empirical research (2024-25):
- "How Far is Video Generation from World Models?" (Liang et al., 2024) — Sora physics-এ ~৩৫% accuracy benchmark-এ।
- NVIDIA-র Cosmos (২০২৫) — explicit "world foundation model" — robotics simulation-এ।
- Wayve-এর GAIA — driving-specific world model।
Pragmatic stance:
- "Soft world model" — useful for content, ad creation।
- "Hard world model" — robotics/simulation/safety-critical — এখনো দূর।
- Both valuable, কিন্তু conflate করা misleading।
মূল উপলব্ধি: "World model" hype phrase — sober assessment চাই। Generate ≠ understand. কিন্তু useful tool নিজেই enough — philosophical claim ছাড়াই।
প্র ০২ একটি Bangladeshi ad agency Sora/Runway use করে TVC বানাতে চায় — actor-এর বদলে AI। Cost, legal, creative trade-off কী?
Bangladesh-এর ad industry annual ৫,০০০+ কোটি টাকা; production এর প্রায় অর্ধেক। Disruption সম্ভাবনা real।
Cost comparison (৩০-second TVC):
- Traditional shoot: Director, actor, location, crew, edit — ১৫-৫০ লক্ষ টাকা।
- Sora/Runway: ৩০ second @ Sora $0.50/second ≈ $২০০। Iterations + edit + sound — মোট ১-৩ লক্ষ।
- Hybrid: AI b-roll + real actor talking head — ৭০% সাশ্রয়।
Quality limitations (২০২৫):
- Video model এখনো ৬০ second-এর বেশি consistent নয়।
- Actor lip-sync precise নয় — TTS lip-sync alignment আলাদা step।
- Bangladesh-specific aesthetic — rickshaw paint, sari, market — limited training data।
- Brand product detail (logo, packaging) — text rendering weak।
Legal landscape:
- Right of publicity: AI actor real কারো face-এ similar হলে — case সম্ভব।
- Disclosure (EU AI Act, US states): AI-generated content label করতে হবে।
- Bangladesh: এখনো explicit law নেই কিন্তু DSA-তে misleading content provision।
- Performer guild (DUS, FBCCI): AI vs labor — global SAG-AFTRA strike-এর resonance।
Creative trade-offs:
- ✅ Iteration speed — ১০ concept একদিনে।
- ✅ Impossible scenes (flying, exotic location)।
- ✅ Localization — ভিন্ন version per market।
- ❌ "AI look" — homogenized aesthetic, brand differentiation hard।
- ❌ Authenticity — Bangladeshi audience real face emotionally trust করে।
- ❌ Star power — Tahsan, Mehazabien-এর equity replicate impossible।
Practical roadmap:
- Now: AI for storyboard, mood-board, pre-viz।
- 6 months: Background, b-roll, stock-replacement।
- 1 year: Mid-budget product video AI-first।
- Premium TVC: Actor-led — হিউম্যান touch-ই brand।
Disclosure example: Pizza Hut Mexico already used "Made with AI" label। Bangladeshi brand-ও early adoption-এ thought leader হতে পারে।
মূল উপলব্ধি: AI video TVC-এ "replace" নয় — "augment"। Cost economics সাশ্রয়ী হলেও quality + emotional + legal-এ traditional এখনো high-end-এ winner।
প্র ০৩ Video diffusion-এ "temporal consistency" সবচেয়ে hard। কীভাবে measure করি? Cross-frame attention vs 3D conv vs latent compression — কোনটা better solution?
Temporal consistency = "এক frame থেকে পরবর্তী frame-এ scene logically continue হচ্ছে কি?"। Image quality হাজার + flicker = unwatchable।
Measurement methods:
- Optical flow consistency: RAFT/FlowNet-এ flow estimate; frame ১ pixel → frame ২ predicted location → reconstruction error।
- CLIP frame similarity: consecutive frames-এর CLIP feature cosine।
- FVD (Fréchet Video Distance): I3D feature-এর Fréchet distance — video-এর FID।
- Subject consistency (DreamSim, DINO): object identity over frames।
- Human eval: "did anything weirdly morph?" — ultimate metric।
- VBench (২০২৪): ১৬-dimensional video benchmark — community standard।
Approach (১) — Cross-frame attention:
- প্রতিটি frame query, all frames key/value — quadratic in T।
- Long video memory issue।
- Sora, CogVideoX এই path।
Approach (২) — 3D convolution:
- Local temporal kernel (e.g. 3 × 3 × 3)।
- Computationally cheap, কিন্তু long-range dependency miss।
- VDM, Make-A-Video early — এখন hybrid approach common।
Approach (৩) — Latent compression:
- 3D VAE — temporal axis 4-8x compress।
- Latent space-এ "feature" frame-জুড়ে stable; pixel-level wobble VAE smooth করে।
- Sora, Mochi এই strategy।
Modern hybrid (২০২৪-২৫):
- 3D VAE + DiT + sliding-window cross-frame attention + temporal LoRA।
- Linear attention (Mamba, Linear Attention) — long sequence cheap।
- Hierarchical — coarse temporal first, fine refinement after।
Bangladesh-specific challenge:
- Saree fabric-এর pleats — model ভুলভাবে animate।
- Bangla signage — frame-by-frame morph।
- Crowded scene (market, traffic) — multi-object tracking weak।
মূল উপলব্ধি: Single architecture solution নেই — হাইব্রিড। Memory, compute, data — তিনটির balance। Human evaluation ছাড়া কোনো metric truly trusted নয়।
প্র ০৪ Election deepfake বাংলাদেশে কীভাবে threat? Detection-এ কী state-of-the-art? Provenance (C2PA, SynthID) আদৌ কাজ করবে?
২০২৪ Bangladesh election-এ AI-generated content circulate হয়েছে — Tarique Rahman-এর fake voice clip, AI-narrator news anchor। Threat real ও present।
Threat surface:
- Voice clone — politician statement fabricate।
- Video face swap — speech বানানো ranking deepfake।
- AI news anchor — fake authoritative narrative।
- Image deepfake — protest, violence misattribute।
- Bot army — generated content amplify।
Detection state-of-the-art (২০২৫):
- Forensic features: face landmark inconsistency, blink rate, skin pulse (rPPG)।
- Frequency artifacts: diffusion model GAN-er চেয়ে আলাদা spectral signature।
- Neural detector: Microsoft Video Authenticator, Intel FakeCatcher।
- Limitation: arms race — detector ৬ মাস পর obsolete।
- Adversarial robustness: compression + small noise → detector fail।
- State-of-the-art detection accuracy ~৭০-৮৫% in-the-wild — far from solved।
Provenance approaches:
- C2PA (Content Credentials): open standard — sign content at creation। Adobe, Microsoft, OpenAI, Sony adopted।
- SynthID (Google DeepMind): imperceptible watermark in pixel/audio।
- Limitations: screenshot, recompress, filter — watermark destroy।
- Adoption gap: bad actor use করে না; verified creator-এর জন্য voluntary।
Bangladesh-specific gaps:
- EC, BTRC-তে AI literacy কম।
- Bangla-specific deepfake detector নেই।
- Major platform (Facebook, YouTube) US-policy follow — Bangla content moderation weak।
- Cyber Security Act 2023 misuse risk — দু'মুখী challenge।
Multi-layered defense:
- Source-side: Politician statement official channel-এ post + sign।
- Distribution: Platform watermark detection + provenance display।
- Audience: Media literacy — "before share, verify"।
- Legal: Specific deepfake-disclosure law (US states-এর model)।
- Newsroom: Established media (Prothom Alo, BBC Bangla) verification SOP।
মূল উপলব্ধি: Pure technology solve না — socio-technical-legal layered defense। Bangladesh-এ early policy + literacy + platform pressure চাই। নির্বাচনে democracy-র ভিত্তি ঝুঁকিতে।
অনুশীলন
-
হিসাব: ৩০ second @ ২৪fps @ 1024×576 RGB video — uncompressed কত GB?
$30 \times 24 \times 1024 \times 576 \times 3 = 1{,}273{,}982{,}976$ byte ≈ ১.১৯ GB। এজন্য latent compression (4-8x temporal + 8x spatial = ~৬৪x reduction) critical।
-
Hands-on: CogVideoX-2b দিয়ে একটি বাংলাদেশ-themed prompt-এ ৫ second video generate করুন। English-এ translate করুন প্রথমে।
Prompt example: "A green-yellow tropical paddy field in rural Bangladesh, sunset golden light, single farmer walking home with bullocks, cinematic wide shot, soft focus."
Inference setting:
num_frames=49, num_inference_steps=50, guidance_scale=6.0। -
Critical thinking: Sora-র demo video-তে কী কী physical inconsistency খুঁজে পান? OpenAI-র gallery দেখুন।
- "Wooly mammoth" — leg ৫টা frame-এ।
- "Tokyo street" — pedestrian sometimes float।
- "Glass shatter" — physics non-conservative।
- "Person eating burger" — bite mark inconsistent।
আরও পড়ুন
- পাঠ ২৩ · 3D generation পরবর্তী পাঠ NeRF, Gaussian splatting — video-র পরবর্তী dimension।
- পাঠ ২১ · Audio generation আগের পাঠ Veo-3-এ video + audio synchronized — দু'টোই বুঝুন।
- Computer Vision Course cross-link Optical flow, video understanding — temporal modeling-এর foundation।
- সব AI Courses দেখুন ABCL TECH Python, ML, DL, NLP, CV, GenAI, RL, MLOps।
enable_model_cpu_offload() ও enable_sequential_cpu_offload() use করুন।
Colab-এ T4 GPU যথেষ্ট।