data_juicer.ops.mapper.video_undistort_mapper module#

data_juicer.ops.mapper.video_undistort_mapper.get_global_intrinsics(ks)[源代码]#
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 = None, undistorted_video_field: str = 'undistorted_video', camera_calibration_field: str = 'camera_calibration', batch_size_each_video: int = 1000, crf: int = 22, *args, **kwargs)[源代码]#

Initialization method.

参数:
  • output_video_dir -- Output directory to save undistorted videos.

  • undistorted_video_field -- The field name to store the tags. It's "undistorted_video" in default.

  • camera_calibration_field -- The field name where the camera calibration info is stored.

  • 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