From c705858790148443ef62d1252aed9e32ccf745d8 Mon Sep 17 00:00:00 2001 From: Victor Zeng Date: Fri, 10 Apr 2020 22:22:36 -0500 Subject: [PATCH 1/2] Resolved Issue #75 Fixed crash when duration is an exact multiple of interval --- vcsi/vcsi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcsi/vcsi.py b/vcsi/vcsi.py index 8ee42f9..077b185 100755 --- a/vcsi/vcsi.py +++ b/vcsi/vcsi.py @@ -1696,7 +1696,7 @@ def process_file(path, args): if args.interval is not None: total_delay = total_delay_seconds(media_info, args) selected_duration = media_info.duration_seconds - total_delay - args.num_samples = math.floor(selected_duration / args.interval.total_seconds()) + args.num_samples = math.floor((selected_duration - 1) / args.interval.total_seconds()) args.num_selected = args.num_samples args.num_groups = args.num_samples From 11f7b6af2775c8df436aa10d1f9d0ae8fc608ffb Mon Sep 17 00:00:00 2001 From: zacker150 Date: Sun, 14 Jun 2020 23:59:13 -0500 Subject: [PATCH 2/2] Removed Sequential processing --- vcsi/vcsi.py | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/vcsi/vcsi.py b/vcsi/vcsi.py index 077b185..e630921 100755 --- a/vcsi/vcsi.py +++ b/vcsi/vcsi.py @@ -705,32 +705,24 @@ def do_capture(ts_tuple, width, height, suffix, args): futures = [] if args.fast: - # use multiple threads - with ThreadPoolExecutor() as executor: - for i, timestamp_tuple in enumerate(timestamps): - status = "Starting task... {}/{}".format(i + 1, args.num_samples) - print(status, end="\r") - suffix = ".jpg" # faster processing time - future = executor.submit(do_capture, timestamp_tuple, desired_size[0], desired_size[1], suffix, args) - futures.append(future) - print() - - for i, future in enumerate(futures): - status = "Sampling... {}/{}".format(i + 1, args.num_samples) - print(status, end="\r") - frame = future.result() - blurs += [ - frame - ] - print() + suffix = ".jpg" # faster processing time else: - # grab captures sequentially + suffix = ".png" # arguably higher image quality + + # use multiple threads + with ThreadPoolExecutor() as executor: for i, timestamp_tuple in enumerate(timestamps): - status = "Sampling... {}/{}".format(i + 1, args.num_samples) + status = "Starting task... {}/{}".format(i + 1, args.num_samples) print(status, end="\r") - suffix = ".png" # arguably higher image quality - frame = do_capture(timestamp_tuple, desired_size[0], desired_size[1], suffix, args) + + future = executor.submit(do_capture, timestamp_tuple, desired_size[0], desired_size[1], suffix, args) + futures.append(future) + print() + for i, future in enumerate(futures): + status = "Sampling... {}/{}".format(i + 1, args.num_samples) + print(status, end="\r") + frame = future.result() blurs += [ frame ]