src.muxer

Separate executable .py file for creating combined audio-video stimuli from all raw datasets

Classes

AVMuxer(input_dir, output_dir[, keys_ext, ...])

Uses FFmpeg to mux raw audio and video footage from each performance in the corpus together.

class src.muxer.AVMuxer(input_dir, output_dir, keys_ext: str = 'Delay', drms_ext: str = 'Delay', **kwargs)

Bases: object

Uses FFmpeg to mux raw audio and video footage from each performance in the corpus together.

_check_filesize(fname: str, performance: str, max_fsize: int = 75)

Checks size of a muxed video and raises a warning if it’s suspicously large (encoding issue)

_create_output_folder() str

Creates an output folder according to the given parameters

static _get_audio_fpath(filename: str) str

Returns the type of audio that is described by this filename

static _get_dict_key(dirpath: str, chars: tuple[str] = ('d', 's', 'l', 'j')) str

Gets the key for our dictionary of filenames. Format is in the form: duoX_sessionX_latencyX_jitterX

_get_matched_fnames() dict

For every performance, matches audio and video filenames for both performers

_get_output_timestamp(v: dict) None

If the given output timestamp video is longer than the duration of the input videos, set this to the duration

_get_performances_to_mux(duos: tuple, jitter: tuple, latency: tuple, sessions: tuple) dict

Gets the filenames of performances to mux from given input iterables

_get_video_crop_params(perf: str) tuple

Gets the crop parameters from the given arguments

static _get_video_duration(filename: str) str

Gets the duration of an input video using ffprobe, in the format HH:MM:SS

static _get_video_fpath(filename: str, key: list) str

Returns the type of video that is described by this filename

_log_progress_bar(current: float, end: float, perf: str) None

Logs current progress of the ffmpeg conversion, including current time, overall duration, and a progress bar

_mux_performance(k: str, v: dict, fname: str) None

Combine both video files together

_read_ffmpeg_output(process: Popen, k: str, timeout_mins: int = 3)

Reads the output from ffmpeg, line by line, and logs a progress bar

static _read_timedelta(line: str) float

Converts the reported time in ffmpeg to a Python timedelta object and gets number of seconds

mux_all_performances(duos: tuple = (1, 2, 3, 4, 5), sessions: tuple = (1, 2), latency: tuple = (0, 23, 45, 90, 180), jitter: tuple = (0, 0.5, 1.0)) None

Muxes all performances together. Duos should be an iterable containing the duo numbers we want to mux.