From 3d436c511ccea1f8cb3a5b73e01d14fbe845365b Mon Sep 17 00:00:00 2001 From: raefu <73382637+raefu@users.noreply.github.com> Date: Sat, 24 Oct 2020 04:25:40 -0700 Subject: [PATCH] updates (#91) * add a fallback font for Debian-based systems dejavu fonts are stored in a different location on Debian/Ubuntu https://packages.debian.org/buster/all/fonts-dejavu-core/filelist * add {{video_bit_rate}} parameter (fixes #90) * use BMP instead of PNG for faster captures this is larger than PNG, but there's no time wasted compressing the temporary file and it's unlikely that the few extra megabytes of disk space matters --- vcsi/{vcsi.py => m} | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename vcsi/{vcsi.py => m} (99%) diff --git a/vcsi/vcsi.py b/vcsi/m similarity index 99% rename from vcsi/vcsi.py rename to vcsi/m index c7967fc..4fd2cc9 100755 --- a/vcsi/vcsi.py +++ b/vcsi/m @@ -72,7 +72,7 @@ def __str__(self): # Defaults DEFAULT_METADATA_FONT = "/usr/share/fonts/TTF/DejaVuSans-Bold.ttf" DEFAULT_TIMESTAMP_FONT = "/usr/share/fonts/TTF/DejaVuSans.ttf" -FALLBACK_FONTS = ["/Library/Fonts/Arial Unicode.ttf"] +FALLBACK_FONTS = ["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", "/Library/Fonts/Arial Unicode.ttf"] # Replace defaults on Windows to support unicode/CJK and multiple fallbacks if os.name == 'nt': @@ -399,6 +399,11 @@ def parse_attributes(self): except KeyError: self.video_codec_long = None + try: + self.video_bit_rate = int(self.video_stream["bit_rate"]) + except KeyError: + self.video_bit_rate = None + try: self.sample_aspect_ratio = self.video_stream["sample_aspect_ratio"] except KeyError: @@ -466,6 +471,7 @@ def list_template_attributes(): table.append({"name": "video_codec", "description": "Video codec", "example": "h264"}) table.append({"name": "video_codec_long", "description": "Video codec (long name)", "example": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"}) + table.append({"name": "video_bit_rate", "description": "Video bitrate", "example": "4000"}) table.append({"name": "display_aspect_ratio", "description": "Display aspect ratio", "example": "16:9"}) table.append({"name": "sample_aspect_ratio", "description": "Sample aspect ratio", "example": "1:1"}) table.append({"name": "audio_codec", "description": "Audio codec", "example": "aac"}) @@ -728,7 +734,7 @@ def do_capture(ts_tuple, width, height, suffix, args): for i, timestamp_tuple in enumerate(timestamps): status = "Sampling... {}/{}".format(i + 1, args.num_samples) print(status, end="\r") - suffix = ".png" # arguably higher image quality + suffix = ".bmp" # lossless frame = do_capture(timestamp_tuple, desired_size[0], desired_size[1], suffix, args) blurs += [