Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Datajuicer Data juicer VideoResolutionFilter

From Leeroopedia
Revision as of 12:24, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Datajuicer_Data_juicer_VideoResolutionFilter.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Data_Quality, Filtering
Last Updated 2026-02-14 16:00 GMT

Overview

Concrete tool for filtering data samples based on video resolution provided by Data-Juicer.

Description

VideoResolutionFilter is a filter operator that keeps samples where the video resolution (width and height in pixels) falls within specified ranges. It extends Filter and uses the two-phase compute_stats/process pattern. It loads videos and reads the video stream's codec context to extract width and height. Caches results under video_width and video_height stats keys. The process_single method checks both dimensions against their respective thresholds, combining results with an 'any' or 'all' strategy across multiple videos per sample. Ensures video datasets meet minimum resolution requirements for model training.

Usage

Import when filtering based on video resolution. Configure in YAML or Python.

Code Reference

Source Location

Signature

@OPERATORS.register_module("video_resolution_filter")
class VideoResolutionFilter(Filter):
    def __init__(self, min_width: int = 1, max_width: int = sys.maxsize, min_height: int = 1, max_height: int = sys.maxsize, any_or_all: str = "any", *args, **kwargs):

Import

from data_juicer.ops.filter.video_resolution_filter import VideoResolutionFilter

I/O Contract

Inputs

Name Type Required Description
min_width int No Minimum horizontal resolution (default: 1)
max_width int No Maximum horizontal resolution (default: sys.maxsize)
min_height int No Minimum vertical resolution (default: 1)
max_height int No Maximum vertical resolution (default: sys.maxsize)
any_or_all str No Keep strategy: "any" or "all" (default: "any")

Outputs

Name Type Description
samples Dict Filtered samples with video_width and video_height stats computed

Usage Examples

YAML Configuration

process:
  - video_resolution_filter:
      min_width: 480
      min_height: 360

Python API

from data_juicer.ops.filter.video_resolution_filter import VideoResolutionFilter
op = VideoResolutionFilter(min_width=480, min_height=360)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment