Skip to main content

Basic Video Inference

Qwen3-VL supports video input through URLs, local paths, or frame sequences.

Video Input Formats

Frame Sampling Control

Using FPS

Control the frame sampling rate using the fps parameter:

Using Fixed Frame Count

Specify the exact number of frames to sample:
When using num_frames, set fps=None to avoid conflicts between the two parameters.

Video Resolution Control

Configure video resolution budget using the processor:

Understanding Video Size Parameters

  • longest_edge: Maximum total pixels across all frames (T × H × W ≤ longest_edge)
  • shortest_edge: Minimum total pixel budget for the video
  • For Qwen3-VL: 32× spatial compression + 2× temporal compression

Performance Optimization

Recommended for Video Processing:Enable flash_attention_2 for better memory efficiency with videos:
Installation:

Video Backends

When using qwen-vl-utils, three video decoding backends are supported:
  • torchvision: Default backend (slower)
  • decord: Faster decoding (Linux recommended)
  • torchcodec: Fastest, recommended (requires FFmpeg)

Backend Compatibility

Next Steps

Pixel Control

Advanced video resolution control with qwen-vl-utils

Generation Parameters

Configure temperature, top_p, and other parameters