Captions and Preview
Prepare inputs, generate window-level captions, optionally refine or enhance them, and produce preview images.
Choose a captioning model
Use the same model_variant in CaptionPreparationStage and CaptionGenerationStage. The preparation stage formats prompts and video frames for that exact checkpoint; the generation stage looks up the prepared input by the variant name.
All checkpoints are downloaded from Hugging Face on each node when absent from model_dir. Caption generation requires vLLM and reserves one GPU per worker. For Qwen, use the fp8 parameter or --captioning-use-fp8-weights; for Nemotron Nano 12B v2, select the precision-specific variant instead. Nemotron 3 Nano Omni uses one video per prompt, a 131,072-token model context, and vLLM compatibility patches that NeMo Curator applies automatically to the downloaded checkpoint.
Quickstart
Pipeline stages
Example script
Prepare caption inputs
CaptionPreparationStage splits each clip into windows, samples frames, and writes the model-ready value to window.llm_inputs[model_variant]. If generate_previews=True, it also keeps MP4 bytes for PreviewStage.
Generate captions
CaptionGenerationStage consumes window.llm_inputs[model_variant] and writes its result to window.caption[model_variant]. After generation it removes that prepared input and the window MP4 bytes.
Refine or enhance captions
NeMo Curator provides two distinct second-pass workflows:
- Same-VLM refinement reruns the selected captioning model with its first caption. Set
generate_stage2_caption=True, or pass--captioning-stage2-caption. The refined text replaces the first-pass value inwindow.caption[model_variant]. - Text-only enhancement runs a separate Qwen language model after caption generation. Add
CaptionEnhancementStage, or pass--enhance-captions. The result is stored inwindow.enhanced_caption["qwen_lm"]and the original caption remains available.
The enhancement model can be qwen2.5 (Qwen/Qwen2.5-14B-Instruct) or qwen3 (Qwen/Qwen3-14B). captioning_model_variant must identify the caption key produced by the earlier generation stage; it does not have to match the enhancement model.
In the example script, --enhance-captions-algorithm selects qwen2.5 or qwen3. The separate --enhanced-caption-models output selector currently accepts only qwen_lm.
Migrate from the former qwen variant
The unversioned qwen identifier is no longer accepted. Replace it with qwen2.5 to retain the previous Qwen2.5-VL behavior, or choose qwen3 explicitly. Update both preparation and generation so their keys continue to match.
For the example script, change --captioning-algorithm qwen to --captioning-algorithm qwen2.5. If you enhance captions programmatically, also set captioning_model_variant="qwen2.5". Qwen video preprocessing is now always handled by the Hugging Face/vLLM processor; remove the former model_does_preprocess argument rather than replacing it.
Preview Generation
Generate lightweight .webp previews for each caption window to support review and QA workflows. A dedicated PreviewStage reads per-window mp4 bytes and encodes WebP using ffmpeg.
Preview Parameters
target_fps(default1.0): Target frames per second for preview generation.target_height(default240): Output height. Width auto-scales to preserve aspect ratio.compression_level(range0–6, default6): WebP compression level.0is lossless; higher values reduce size with lower quality.quality(range0–100, default50): WebP quality. Higher values increase quality and size.num_cpus_per_worker(default4.0): Number of CPU threads mapped toffmpeg -threads.verbose(defaultFalse): Emit more logs.
Behavior notes:
- If the input frame rate is lower than
target_fpsor the input height is lower thantarget_height, the stage logs a warning and preview quality can degrade. - If
ffmpegfails, the stage logs the error and skips assigning preview bytes for that window.
Example: Configure PreviewStage
Outputs
The stage writes .webp files under the previews/ directory that ClipWriterStage manages. Use the helper to resolve the path:
Refer to Save & Export for directory structure and file locations: Save & Export.
Requirements and Troubleshooting
ffmpegwith WebP (libwebp) support must be available in the environment.- If you observe warnings about low frame rate or height, consider lowering
target_fpsortarget_heightto better match inputs. - On encoding errors, check logs for the
ffmpegcommand and output to diagnose missing encoders.