fix: incorrect progress bar tracking

Hacky workaround that involves working with FFMPEG negative timestamping
This commit is contained in:
2026-02-02 23:58:53 +00:00
parent 996568a43c
commit d6867c0df3

View File

@@ -180,6 +180,9 @@ def _concat_ts_files(file_list: list[str], start_offset: float, end_offset: floa
bufsize=1, bufsize=1,
) )
init_ms_val = 0
init_ms_val_set = False
with tqdm( with tqdm(
total=length, total=length,
unit="s", unit="s",
@@ -191,9 +194,16 @@ def _concat_ts_files(file_list: list[str], start_offset: float, end_offset: floa
for line in process.stdout: for line in process.stdout:
line = line.strip() line = line.strip()
if line.startswith("out_time_ms="): if line.startswith("out_time_ms="):
out_time_ms = int(line.split("=")[1]) out_time_ms = int(line.split("=")[1])
seconds = round(out_time_ms / 1_000_000)
if not init_ms_val_set:
init_ms_val = out_time_ms
init_ms_val_set = True
out_time_ms -= init_ms_val
seconds = abs(out_time_ms / 1_000_000)
pbar.n = min(seconds, length) pbar.n = min(seconds, length)
pbar.refresh() pbar.refresh()