Skip to content

Commit

Permalink
updates (#91)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
raefu authored Oct 24, 2020
1 parent ed84d44 commit 3d436c5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vcsi/vcsi.py → vcsi/m
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"})
Expand Down Expand Up @@ -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 += [
Expand Down

0 comments on commit 3d436c5

Please sign in to comment.