114 original_fps = video_track.original_frame_rate
115 subprocess.check_output([
116 "mkvmerge", "--output", out_path,
117 "--default-duration", "%d:%sfps" % (video_track.track_id - 1, original_fps),118 file_path
119 ], cwd=file_path.parent)
120 return out_path
109 # TODO: could be untrusted, user might just make a file named this
110 return out_path
111 if video_track.framerate_original_num and video_track.framerate_original_den:
112 original_fps = "%s/%s" % (video_track.framerate_original_num, video_track.framerate_original_den)113 else:
114 original_fps = video_track.original_frame_rate
115 subprocess.check_output([
96 prop_src=core.vivtc.VDecimate(clip, cycle=cycle, dryrun=True)
97 )
98 return core.vivtc.VDecimate(clip, cycle=cycle)
99 raise ValueError("pvsfunc.decimate: Incorrect mode (%d), it must be an int value between 0-1" % mode)
86 functools.partial(
87 lambda n, f, c: core.text.Text(
88 c,
89 " mode=%d cycle=%d \n"90 " Important: Please consider another mode. More information: git.io/avoid-tdecimate. \n"
91 " decimated_frame=%s \n" % (mode, cycle, f.props['VDecimateDrop'] == 1),
92 alignment=1
71 " mode=%d cycle=%d offsets=%s fps=%d/%d \n" % (
72 mode, cycle, offsets, res.fps.numerator, res.fps.denominator
73 ) +
74 " offset=%d decimate=%s \n" % (n % cycle, (n % cycle) not in offsets),75 alignment=1
76 ),
77 c=clip
f-strings are the fastest way to format strings as compared to the following methods:
%
format()
str.join
+
operator to concatinate stringTemplate.substitute
Some less preferred ways to format strings are the following:
from string import Template
menu = ('eggs', 'spam', 42.4)
old_order = "%s and %s: %.2f ¤" % menu # [consider-using-f-string]
beginner_order = menu[0] + " and " + menu[1] + ": " + str(menu[2]) + " ¤"
joined_order = " and ".join(menu[:2])
format_order = "{} and {}: {:0.2f} ¤".format(menu[0], menu[1], menu[2])
named_format_order = "{eggs} and {spam}: {price:0.2f} ¤".format(eggs=menu[0], spam=menu[1], price=menu[2])
template_order = Template('$eggs and $spam: $price ¤').substitute(eggs=menu[0], spam=menu[1], price=menu[2])
Consider using f-strings as shown below:
menu = ('eggs', 'spam', 42.4)
f_string_order = f"{menu[0]} and {menu[1]}: {menu[2]:0.2f} ¤"