Implementation:Datajuicer Data juicer VideoFFmpegWrappedMapper
| Knowledge Sources | |
|---|---|
| Domains | Data_Processing, Mapping |
| Last Updated | 2026-02-14 16:00 GMT |
Overview
Concrete tool for applying FFmpeg video filters within the pipeline provided by Data-Juicer.
Description
VideoFFmpegWrappedMapper is a mapper operator that provides a general-purpose wrapper around FFmpeg video filters, enabling users to apply any FFmpeg filter to video files within the Data-Juicer pipeline through a simple configuration interface. It takes a filter name, keyword arguments, and optional global FFmpeg arguments, applies the specified filter to each video using the ffmpeg-python library, saves the processed output with a deterministic filename, and updates the sample's file path references accordingly.
Usage
Use when you need to apply any FFmpeg filter transformation to video files that is not covered by a specialized operator, leveraging the full power of FFmpeg's filter ecosystem.
Code Reference
Source Location
- Repository: Datajuicer_Data_juicer
- File: data_juicer/ops/mapper/video_ffmpeg_wrapped_mapper.py
Signature
@OPERATORS.register_module("video_ffmpeg_wrapped_mapper")
class VideoFFmpegWrappedMapper(Mapper):
def __init__(self, filter_name: Optional[str] = None, filter_kwargs: Optional[Dict] = None, global_args: Optional[List[str]] = None, capture_stderr: bool = True, overwrite_output: bool = True, save_dir: str = None, *args, **kwargs):
Import
from data_juicer.ops.mapper.video_ffmpeg_wrapped_mapper import VideoFFmpegWrappedMapper
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| filter_name | str | No | FFmpeg video filter name (default: None, videos remain unmodified) |
| filter_kwargs | Dict | No | Keyword arguments passed to the FFmpeg filter (default: None) |
| global_args | List[str] | No | List arguments passed to the FFmpeg command line (default: None) |
| capture_stderr | bool | No | Whether to capture stderr output (default: True) |
| overwrite_output | bool | No | Whether to overwrite output files (default: True) |
| save_dir | str | No | Directory for generated video files; if not specified, saves alongside input files |
Outputs
| Name | Type | Description |
|---|---|---|
| samples | Dict | Transformed samples with filtered video file paths |
Usage Examples
process:
- video_ffmpeg_wrapped_mapper:
filter_name: "eq"
filter_kwargs:
brightness: 0.1
contrast: 1.2