From d8a76e71de7dfa6692ffcb9d7a1a293d8f319157 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Fri, 22 Feb 2019 03:48:18 -0700 Subject: edit options --- options.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'options.py') diff --git a/options.py b/options.py index e93826f..763eba6 100644 --- a/options.py +++ b/options.py @@ -197,10 +197,10 @@ class OptionsPanel(wx.Panel): self.height.set_calc_new(round(orig_height / orig_width * new_width)) orig_framerate = float(self.framerate.get_orig()) - self.framerate.set_range(0, 10 * orig_framerate) + self.framerate.set_range(0, orig_framerate) self.framerate.set_calc_new(orig_framerate) - def update(self, path, info): + def update(self, info): import fractions if info is None: @@ -224,3 +224,32 @@ class OptionsPanel(wx.Panel): self.Enable() self.Layout() self.enforce_constraints() + + def ffmpeg_opts(self): + opts = [] + + if self.start_time.is_edit(): + opts += ['-ss', str(self.start_time.get_final())] + elif self.end_time.is_edit() and self.duration.is_edit(): + new_end = float(self.end_time.get_final()) + new_duration = float(self.duration.get_final()) + new_start = new_end - new_duration + opts += ['-ss', str(new_start)] + if self.end_time.is_edit(): + opts += ['-to', str(self.end_time.get_final())] + if self.duration.is_edit(): + opts += ['-t', str(self.duration.get_final())] + + if self.width.is_edit() or self.height.is_edit(): + width = str(self.width.get_final()) + height = str(self.height.get_final()) + if not self.width.is_edit(): + width = "-1" + if not self.height.is_edit(): + height = "-1" + opts += ['-vf', 'scale=' + width + ':' + height] + + if self.framerate.is_edit(): + opts += ['-r', str(self.framerate.get_final())] + + return opts -- cgit v1.2.3