ReelCodeBench / README.md
marcuskwan's picture
Add files using upload-large-folder tool
33dd48f verified
|
Raw History Blame
5.57 kB
metadata
license: other
license_name: per-clip-licenses
pretty_name: ReelCodeBench
language:
  - en
task_categories:
  - video-text-to-text
tags:
  - video-to-code
  - code-generation
  - video-editing
  - benchmark
  - animation
size_categories:
  - n<1K
configs:
  - config_name: reconstruction
    data_files:
      - split: test
        path: data/reconstruction.jsonl
  - config_name: edit
    data_files:
      - split: test
        path: data/edit.jsonl

ReelCodeBench

ReelCodeBench tests whether a model can turn a short video into code that renders it, and then change that code to follow an edit request.

  • Reconstruction (420 clips). The model sees frames of a reference video and writes one self-contained index.html that reproduces it.
  • Editing (420 tasks, one per clip). The model gets its own reconstruction and a text edit request with one to three changes (where / when / how), and edits the code.

Code, renderer and evaluation: GitHub: TODO-github-link

Files

data/reconstruction.jsonl   420 clips: metadata, frame list, rubric
data/edit.jsonl             420 edit tasks: instruction, changes with time windows and check questions, must-stay items
videos/<clip_id>.mp4        reference videos
frames/<clip_id>/*.jpg      reference frames at 2 fps (what the solver sees)
prompts/*.md                the exact prompts used in the paper

reconstruction

Field Meaning
clip_id clip id, also the key into edit
source, source_url, author, title, license where the clip comes from and its license
duration_s, width, height, fps the reconstruction must match width x height and duration_s
video path of the reference video
frames [{t, file}], reference frames at 2 fps; give all of them to the solver
judge_frame_indices indices into frames shown to the judge (at most 60)
rubric 10-14 yes/no items {id, question, weight, dim, time} used by the reconstruction judge; dim is text, layout, style, motion or timing
content, form, motion, is_3d, complexity category labels

edit

Field Meaning
task_id, clip_id task id and the clip it edits
instruction the edit request given to the model (English); instruction_zh is a Chinese version
changes [{desc, domain, section, operation, window, checks}]: what should change, in which time window, and the yes/no questions the judge answers
must_stay things that must not change, used by the judge
tags reach, instruction form, grounding, intent

Loading

from datasets import load_dataset
from huggingface_hub import snapshot_download

recon = load_dataset("marcuskwan/ReelCodeBench", "reconstruction", split="test")
edit = load_dataset("marcuskwan/ReelCodeBench", "edit", split="test")
root = snapshot_download("marcuskwan/ReelCodeBench", repo_type="dataset")  # videos and frames

Minimal reconstruction call

import base64, json, re
from pathlib import Path
from openai import OpenAI

P = Path(root) / "prompts"
fill = lambda t, **kw: re.sub(r"\{(\w+)\}", lambda m: str(kw.get(m.group(1), m.group(0))), t)
x = recon[0]
prompt = fill((P / "recon.md").read_text(),
              n_frames=len(x["frames"]), duration=x["duration_s"], width=x["width"], height=x["height"], fps=x["fps"],
              frame_list="; ".join(f"image {i+1} = t {f['t']:.2f}s" for i, f in enumerate(x["frames"])),
              RECORDER_CONTRACT=(P / "recorder_contract.md").read_text(), vendor_list=(P / "vendor_list.md").read_text(),
              canvas_w=x["width"], canvas_h=x["height"])
images = [{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + base64.b64encode((Path(root) / f["file"]).read_bytes()).decode()}}
          for f in x["frames"]]
r = OpenAI().chat.completions.create(model="gpt-5", messages=[{"role": "user", "content": [{"type": "text", "text": prompt}, *images]}])
html = re.search(r"```html\s*(.*?)```", r.choices[0].message.content, re.S).group(1)
Path("index.html").write_text(html)

Rendering index.html to video and judging it are done by the evaluation code on GitHub.

Scoring

Every item is scored by two judges and the two are averaged. Failed items score 0.

  • Reconstruction: S = 0.5 * DA + 0.5 * H. DA is the share of rubric weight in dimensions whose items all pass. H is the mean of four 1-5 holistic scores mapped to 0-100.
  • Editing: S = 100 * sqrt(C * (0.5 K + 0.5 Q)). C is change completion, K is the share of must-stay items kept, and Q is visual quality. The judge compares the edited render against the original video.

Sources and licenses

Each clip keeps the license of its source; see the source, source_url, author and license fields.

Source Clips License
LottieFiles 158 LottieFiles
LemoLab (lemo-opuscar) 74 videos CC BY 4.0, code MIT; credit LemoLab
YouTube (Creative Commons) 73 CC BY; credit the channel
Code2Video-Compass 51 see source
Open-source code animations on GitHub (Canvas, HTML, SVG, three.js, Lottie, data viz) 54 MIT or Apache-2.0, per repository
video-shotcraft 10 Apache-2.0

Known issues

  • In six clips (canvas2_0001, canvas2_0002, canvas2_0003, canvas_0005, canvas_0007, dataviz2_0003) the reference render shows Chinese text as empty boxes because no CJK font was installed on the render machine. The clips are released as used in the paper.

Citation

TODO