data_juicer.ops.mapper.video_undistort_mapper module#

class data_juicer.ops.mapper.video_undistort_mapper.VideoUndistortMapper(*args, **kwargs)[source]#

Bases: Mapper

Undistort raw videos with corresponding camera intrinsics and distortion coefficients.

__init__(output_video_dir: str = '/home/runner/.cache/data_juicer/assets', tag_field_name: str = 'video_undistortion_tags', batch_size_each_video: int = 1000, crf: int = 22, *args, **kwargs)[source]#

Initialization method.

Parameters:
  • output_video_dir – Output directory to save undistorted videos.

  • tag_field_name – The field name to store the tags. It’s “video_undistortion_tags” in default.

  • batch_size_each_video – Number of frames to process and save per temporary TS file batch.

  • crf – Constant Rate Factor (CRF) for FFmpeg encoding quality.

  • args – extra args

  • kwargs – extra args

concatenate_ts_files(folder, video_name, batch_counts)[source]#

Concatenate batch TS files into final mp4.

create_ffmpeg_writer(output_path, width, height, fps, crf)[source]#

Spawn an ffmpeg async encoding process for writing raw frames.

process_single(sample, context=False)[source]#

For sample level, sample –> sample

Parameters:

sample – sample to process

Returns:

processed sample