मैं किसी viral video edit को cut-by-cut code में कैसे reverse-engineer करता हूँ
लेखक: Pranav T · · 4 मिनट में पढ़ें
छोटा जवाब
Video Reverse Engineer (editast) एक open-source Python tool है जो बना-बनाया video पढ़कर लिख देता है कि उसे कैसे edit किया गया। इससे एक Edit AST मिलता है: हर cut, transition, zoom, speed ramp और caption, timestamps के साथ, music के beats और drop से जुड़े हुए। यह CPU पर offline चलता है (52 सेकंड के trailer में लगभग 25 सेकंड लगते हैं) और अपने held-out benchmark पर कुल 0.994 score करता है। वही AST फिर template का काम करता है: इसे अपने clips और गाने पर चलाइए और यह नया edit render कर देता है जिसमें cuts beat पर पड़ते हैं।
यह असल में बनाता क्या है?
Short-form edits के patterns होते हैं: एक hook, एक build, एक drop, beat पर cuts, bass hit पर zoom। मैं इन patterns को data के रूप में देखना चाहता था, frame-by-frame अंदाज़ा लगाकर नहीं। इसलिए editast किसी video को Edit AST में बदल देता है, यानी edit का abstract syntax tree, ठीक वैसे जैसे compiler code के लिए बनाता है:
- media: size, frame rate, duration और aspect ratio
- music: BPM, beat grid, downbeats, drops, energy और sections
- timeline: shots से बने sections (hook, build, drop, outro), हर shot के साथ उसकी timing, beats में लंबाई, वह beat पर पड़ता है या नहीं, और उसके effects व transition
- overlays: burned-in captions, हर शब्द की timing के साथ
- patterns: editing के वे नियम जो यह infer करता है, जैसे “drop के दौरान हर beat पर cut”
- stats: pacing, shot की लंबाइयाँ, beat पर पड़े cuts का हिस्सा, और effects का मिश्रण
यह आपको JSON (JSON Schema के साथ), एक पढ़ने लायक .edit script, जो बिना कुछ खोए वापस JSON में बदल जाती है, और एक interactive HTML timeline के रूप में मिलता है।
Analysis pipeline कैसे काम करती है?
Frames को 320 pixel की लंबी side और constant frame rate पर decode किया जाता है, साथ में mono audio भी। फिर छह analysers चलते हैं:
| Analyser | क्या ढूँढता है | कैसे |
|---|---|---|
| shots | Cuts, flashes, fades, dissolves | Adaptive thresholds के साथ frame differences |
| motion | Zoom, pan, rotation, shake | Feature tracking और RANSAC similarity transforms, fitted easing curves के साथ |
| timefx | Speed ramps, slow motion, freezes | समय के साथ motion कितनी तेज़ी से बदलती है |
| look | Colour grade, black and white, blur, invert, RGB split, letterbox | हर frame के image statistics |
| text | Captions और burned-in text | RapidOCR से offline OCR, frames में tracked |
| audio | Tempo, beats, downbeats, drops, sections | numpy और scipy से dynamic-programming beat tracking |
फिर एक build step सब कुछ जोड़ता है: यह shots को sections में group करता है, cuts को beats से मिलाता है, दोहराए गए patterns ढूँढता है और stats निकालता है।
यह कितना accurate है?
Edit को हाथ से जाँचना धीमा है, इसलिए tool खुद अपना test करता है। bench command किसी जाने-पहचाने AST से synthetic edits बनाता है, उन्हें render करता है, नतीजे का analysis करता है और मिलान का score देता है:
| Benchmark | कुल | Cuts F1 | Effects F1 | Beats F | Text F1 |
|---|---|---|---|---|---|
| Held-out seeds 100 से 107 | 0.994 | 0.995 | 0.982 | 0.988 | 1.000 |
| Seeds 0 से 3 | 0.999 | 1.000 | 1.000 | 0.993 | 1.000 |
असली footage पर, यानी 52 सेकंड के Sintel trailer पर, shot boundaries ने हाथ से किए labels के मुकाबले 0.95 precision और 1.00 recall score किया। 1.1 से 9.4 million views वाली 10 car-edit YouTube Shorts में 73% से 97% cuts beat पर पड़े, और drop video के 35% से 61% हिस्से के बाद आया।
किसी edit को अपनी footage पर दोबारा कैसे इस्तेमाल करें?
AST एक template की तरह काम करता है। fit उसे नए गाने के हिसाब से खींचकर बैठाता है, ताकि cuts उस गाने के beats पर पड़ें और template का drop गाने के drop से मिल जाए। कई templates दें तो यह उन्हें इस आधार पर rank करता है कि किसे सबसे कम बदलना पड़ा। फिर render आपके clips से video बनाता है:
pip install editast
editast analyze https://youtube.com/shorts/… # JSON, .edit script and HTML report
editast show edit.json --format summary
editast render edit.json --clips ./my-clips --music song.mp3 --fit -o out.mp4पूरा loop (analyse, re-time, render, फिर से analyse) end to end tested है, इसलिए render किए गए edit को उस template से मिलाकर जाँचा जा सकता है जिससे वह बना था।
यह अभी क्या सही नहीं पकड़ता?
- Benchmark पर लगभग एक चौथाई speed ramps छूट जाते हैं, क्योंकि speed detection को false positives से बचने के लिए tune किया गया है।
- लंबे dissolves मिल जाते हैं, लेकिन उनका start time अक्सर थोड़ा देर से रखा जाता है।
- Title card में जाने वाला dissolve hard cut के रूप में report होता है।
- असली car edits में static-noise glitch transitions कई छोटे-छोटे shots में बँट जाते हैं, beat tracker off-beats पर अटक सकता है, और number plates captions की तरह दिख सकती हैं।
अक्सर पूछे जाने वाले सवाल
- क्या मैं पता लगा सकता हूँ कि किसी TikTok या Reel में कौन-से effects और transitions इस्तेमाल हुए हैं?
- हाँ। File या उसके URL पर editast analyze चलाइए। Report में हर cut, transition (flash, fade, dissolve, whip, zoom, spin, glitch), zoom, shake, speed ramp और caption timestamps के साथ लिस्ट होता है।
- क्या यह किसी edit को मेरे अपने clips और music पर कॉपी कर सकता है?
- हाँ। editast render analyse किया हुआ edit, आपका clips folder और एक गाना लेता है। --fit के साथ यह cuts को नए गाने के beats पर ले जाता है और drop को मिला देता है।
- क्या इसके लिए GPU या API key चाहिए?
- नहीं। यह सामान्य laptop CPU पर offline चलता है; 52 सेकंड के trailer का analysis करने में लगभग 25 सेकंड लगते हैं।
- Cut detection कितनी accurate है?
- Held-out synthetic edits पर cut detection 0.995 F1 score करती है, और असली Sintel trailer पर इसने हर shot boundary पकड़ी (recall 1.00), 0.95 precision के साथ।
और लेख
- Signify (ppt-remote) कैसे काम करता है: आपके slides के लिए hand gestures और फ़ोन वाला laser pointer
- Time-aware RAG: मैंने AsOf कैसे बनाया ताकि वह बता सके “date X को GST का नियम क्या था?”
- Kubernetes में WebSocket के responses क्यों गायब हो जाते हैं, और Redis Pub/Sub इसे कैसे ठीक करता है
- क्या Kubernetes pods का अपना Linux kernel होता है? नहीं, और यह रहा कारण