Progress#
Console output: logging, and tqdm bars fed by the ffmpeg -progress stream.
- class remote_compression.progress.BatchBar(total, enabled=True)[source]#
Whole-batch bar: one tick per file, with status counters as postfix.
- class remote_compression.progress.FileBar(name, duration=None, enabled=True)[source]#
Per-file encode bar: seconds encoded out of the file duration.
- remote_compression.progress.LOG_RETENTION_DAYS = 30#
Age (days) beyond which per-run log files are purged at startup.
- class remote_compression.progress.ProgressStream(callback=None)[source]#
Incremental parser of the ffmpeg
-progressstream.Feed it arbitrary text chunks (they may split lines anywhere); it tracks the encoded position in seconds and the encoding speed, and invokes callback at the end of each progress block (the
progress=line, ~2 per second).- Parameters:
callback (callable, optional) – Called with the stream itself after each progress block.
- class remote_compression.progress.TqdmHandler(level=0)[source]#
Logging handler routed through
tqdm.tqdm.write()so bars stay intact.
- remote_compression.progress.bars_enabled(no_progress=False)[source]#
- Returns:
Whether progress bars should be drawn: not explicitly disabled, and stderr is a real terminal.
- Return type:
- remote_compression.progress.human_size(n)[source]#
-
Examples
>>> human_size(0) '0 B' >>> human_size(2048) '2.0 KB' >>> human_size(3 * 1024**3) '3.0 GB'
- remote_compression.progress.logs_dir()[source]#
- Returns:
Directory of the per-run log files.
- Return type:
- remote_compression.progress.parse_progress_line(line)[source]#
Parse one line of ffmpeg
-progressoutput.- Parameters:
line (
str) – Akey=valueline.- Returns:
(key, value), or None for anything else.- Return type:
tupleor None
Examples
>>> parse_progress_line('out_time_us=4520000') ('out_time_us', '4520000') >>> parse_progress_line('speed=1.19x') ('speed', '1.19x') >>> parse_progress_line('not a progress line') is None True
- remote_compression.progress.setup_logging(verbosity=0)[source]#
Configure the
rcomplogger: console handler at the requested verbosity, plus a DEBUG file handler on a fresh per-run file (parallel rcomp processes never share a log file, so there is no rotation and no locking).- Parameters:
verbosity (
int) – Negative for quiet (warnings only), 0 for normal (one line per file), positive for verbose (full commands, ffmpeg stderr).