CodeCap-Bench: Can Code Serve as a Good Video Caption?
Organizations: NJU · Kling AI · TJU · SJTU ·
Abstract
Video captioning aims to preserve visual information through compact descriptions, predominantly using natural language. However, precisely expressing fine-grained spatial structures and temporal dynamics in natural language often leads to lengthy and potentially ambiguous descriptions. In this work, we explore Code as Video Caption, a paradigm where executable programs serve as a complementary representation of visual content through graphical primitives, layout rules, and functions of time. To examine whether code captions effectively preserve video information, we compare them with natural language captions on downstream question answering and video reconstruction tasks. Our results show that code captions achieve superior reasoning accuracy and reconstruction fidelity. Despite these advantages, realizing the potential of code captioning depends on whether current multimodal large language models (MLLMs) can generate faithful code captions. To systematically assess this capability, we introduce CodeCap-Bench, which comprises 323 videos spanning five categories of structured 2D content, along with fine-grained annotations and a multi-level evaluation framework. Extensive experiments reveal that while leading proprietary MLLMs demonstrate promising code captioning capabilities, they still struggle to faithfully capture complex temporal dynamics, with open-source models lagging substantially behind.
Figures & tables
| Model | Harness | Video Production Success Rate (%) | Visual similarity | Object-level Spatio-temporal IoU | Fine-grained Visual Information Retention | ||
| Dynamic | Static | Overall | |||||
| Agentic | |||||||
| GPT-6-astra | Codex | 99.4 | 0.9735 | 75.37 | 68.61 | 80.72 | 73.24 |
| GPT-6-astra | Pi Agent | 99.7 | 0.9771 | 74.45 | 67.66 | 81.35 | 72.87 |
| Opus-5 | Pi Agent | 97.8 | 0.9449 | 61.45 | 55.49 | 65.10 | 58.84 |
| Opus-5 | Claude Code | 99.4 | 0.9555 | 58.55 | 53.23 | 63.40 | 56.88 |
| Caption model | Code-rendered video QA | Natural language caption QA |
| GPT-5.6-sol | 76.42 | 73.58 |
| Opus-5 | 83.02 | 72.64 |
| Qwen3.8-max | 81.13 | 78.30 |
| Original videos | 83.96 | |
| Caption model | Method | AS | MPS | KSS |
| GPT-5.6-sol | Code rendering | 0.8907 | 0.5412 | 0.8068 |
| Caption-to-video | 0.6628 | 0.5156 | 0.5925 | |
| Opus-5 | Code rendering | 0.9148 | 0.5572 | 0.8165 |
| Caption-to-video | 0.6932 | 0.5150 | 0.5958 | |
| Qwen3.8-max | Code rendering | 0.8773 | 0.5488 | 0.7817 |
| Caption-to-video | 0.6754 | 0.5185 | 0.5984 |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Item | Configuration | Description |
| Agent harness | Pi Agent 1.1.0; Codex CLI 0.155.1; Claude Code 2.1.296 | Versions used for code generation |
| Code generation time limit | 3,600 seconds | Timed separately for each video; Qwen3.8-max at xhigh thinking effort has a 7,200-second limit |
| Video rendering time limit | 900 seconds | Time limit for a single rendering process |
| Video rendering frame rate | 24 fps | Call the page’s seek(seconds) interface at -second intervals along the video timeline, capture screenshots, and encode them into a video |
Video Captioning
Video captioning turns visual and audiovisual sequences into language that describes their events, entities, timing, and context.
See all 68 papers