add slit center option

This commit is contained in:
j 2019-03-27 13:41:47 +08:00
parent 0d8495ea8f
commit f33a1cfe4f
2 changed files with 11 additions and 3 deletions

View file

@ -42,6 +42,7 @@ tiles without having to decode the video again.
parser.add_option('-s', '--sizes', dest='sizes', help='timeline size(s) (64 or 64,16)')
parser.add_option('-w', '--wide', dest='wide', default=False, action='store_true', help='keep wide frames tiles')
parser.add_option('-l', '--log', dest='log', default=False, action='store_true', help='log performance')
parser.add_option('-x', '--slit-position', dest='slit_position', default=None, action='store_true', help='slit scan position (default center frame)')
(opts, args) = parser.parse_args()
if None in (opts.modes, opts.sizes, opts.tiles) or not args:
@ -54,4 +55,4 @@ tiles without having to decode the video again.
opts.modes = [m.strip() for m in opts.modes.split(',')]
opts.sizes = list(map(int, opts.sizes.split(',')))
oxtimelines.Timelines(opts.videos, opts.tiles, opts.cuts, opts.points, opts.modes, opts.sizes, opts.wide, opts.log).render()
oxtimelines.Timelines(opts.videos, opts.tiles, opts.cuts, opts.points, opts.modes, opts.sizes, opts.wide, opts.log, slit_positoin=opts.slit_position).render()

View file

@ -23,7 +23,8 @@ class Timelines():
def __init__(
self, video_files, tile_path, cuts_path,
points, modes, sizes, render_wide_tiles, log
points, modes, sizes, render_wide_tiles, log,
slit_position=None
):
self.video_files = video_files
@ -46,6 +47,11 @@ class Timelines():
self.render_data = 'data' in modes
self.render_video = len(modes) > 1 if self.render_audio else True
if slit_position:
self.frame_center = int(slit_position)
else:
self.frame_center = None
if self.detect_cuts or self.render_cuts or self.render_keyframes:
self.detect_cuts = True
self.cuts = [0]
@ -132,7 +138,8 @@ class Timelines():
frame_size = self.videos[0].get_size()
self.frame_w = frame_size[0]
self.frame_ratio = frame_size[0] / frame_size[1]
self.frame_center = int(frame_size[0] / 2)
if self.frame_center is None:
self.frame_center = int(frame_size[0] / 2)
self.large_tile_n = int(math.ceil(self.frame_n / self.large_tile_w))
self.large_tile_last_w = self.frame_n % self.large_tile_w or self.large_tile_w