data_juicer.ops.mapper.video_undistort_mapper module#

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

基类: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)[源代码]#

Initialization method.

参数:
  • 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)[源代码]#

Concatenate batch TS files into final mp4.

create_ffmpeg_writer(output_path, width, height, fps, crf)[源代码]#

Spawn an ffmpeg async encoding process for writing raw frames.

process_single(sample, context=False)[源代码]#

For sample level, sample --> sample

参数:

sample -- sample to process

返回:

processed sample