Compare commits
5 commits
82df6efee4
...
d3a4c0a140
Author | SHA1 | Date | |
---|---|---|---|
d3a4c0a140 | |||
8fa66491fe | |||
657a1dd234 | |||
f3771f1b56 | |||
b9ac80398c |
4 changed files with 21 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
# GPL 2008-2014
|
||||
|
|
|
@ -13,14 +13,7 @@ import numpy as np
|
|||
import ox
|
||||
|
||||
|
||||
FFMPEG = None
|
||||
for cmd in ('ffmpeg', 'avconv'):
|
||||
cmd = ox.file.cmd(cmd)
|
||||
if subprocess.call(['which', cmd], stdout=subprocess.PIPE) == 0:
|
||||
FFMPEG = cmd
|
||||
break
|
||||
if not FFMPEG:
|
||||
print("could not find ffmpeg, make sure its installed and available in PATH")
|
||||
FFMPEG = 'ffmpeg'
|
||||
FPS = 25
|
||||
|
||||
class Video(object):
|
||||
|
|
|
@ -44,10 +44,9 @@ class Timelines():
|
|||
self.render_slitscan = 'slitscan' in modes
|
||||
if 'multiline' in modes:
|
||||
info = ox.avinfo(video_files[0])
|
||||
self.render_multiline = info['video'][0]['width']
|
||||
self.output_h = sizes[0]
|
||||
sizes = [info['video'][0]['height']] + sizes[1:]
|
||||
self.render_multiline = True
|
||||
self.render_multiline = info['video'][0]['width']
|
||||
self._pool = ThreadPool(multiprocessing.cpu_count())
|
||||
else:
|
||||
self.render_multiline = False
|
||||
|
@ -214,10 +213,10 @@ class Timelines():
|
|||
paste = (large_tile_x, 0)
|
||||
|
||||
# render antialias tile
|
||||
self.log and self.profiler.set_task('i.resize((1, h), Image.ANTIALIAS) # antialias timelines')
|
||||
self.log and self.profiler.set_task('i.resize((1, h), Image.LANCZOS) # antialias timelines')
|
||||
if self.render_antialias or self.render_cuts:
|
||||
resize = (1, self.large_tile_h)
|
||||
antialias_image = frame_image.resize(resize, Image.ANTIALIAS)
|
||||
antialias_image = frame_image.resize(resize, Image.LANCZOS)
|
||||
if self.render_antialias:
|
||||
self.large_tile_image['antialias'].paste(antialias_image, paste)
|
||||
|
||||
|
@ -235,8 +234,8 @@ class Timelines():
|
|||
|
||||
# render data tile
|
||||
if self.render_data or self.detect_cuts:
|
||||
self.log and self.profiler.set_task('i.resize((8, 8), Image.ANTIALIAS) # cut detection')
|
||||
data_image = frame_image.resize((8, 8), Image.ANTIALIAS)
|
||||
self.log and self.profiler.set_task('i.resize((8, 8), Image.LANCZOS) # cut detection')
|
||||
data_image = frame_image.resize((8, 8), Image.LANCZOS)
|
||||
if self.render_data:
|
||||
self.large_tile_image['data'].paste(data_image, (large_tile_x * 8, 0))
|
||||
self.log and self.profiler.unset_task()
|
||||
|
@ -316,7 +315,7 @@ class Timelines():
|
|||
if mode == 'keyframeswide':
|
||||
resize = (self.wide_frame_w, self.large_tile_h)
|
||||
self.log and self.profiler.set_task('i,resize((w, h)) # keyframeswide timelines')
|
||||
frame_image = frame_image.resize(resize, Image.ANTIALIAS)
|
||||
frame_image = frame_image.resize(resize, Image.LANCZOS)
|
||||
self.log and self.profiler.unset_task()
|
||||
left = int((self.frame_w * wide - image_w) / 2)
|
||||
crop = (left, 0, left + image_w, self.large_tile_h)
|
||||
|
@ -424,7 +423,7 @@ class Timelines():
|
|||
if self.full_tile_widths[0] > 0 and self.large_tile_h > 0:
|
||||
resized = self.large_tile_image[mode].resize((
|
||||
self.full_tile_widths[0], self.large_tile_h
|
||||
), Image.ANTIALIAS)
|
||||
), Image.LANCZOS)
|
||||
self.full_tile_image.paste(resized, (self.full_tile_offset, 0))
|
||||
self.full_tile_offset += self.full_tile_widths[0]
|
||||
self.full_tile_widths = self.full_tile_widths[1:]
|
||||
|
@ -439,7 +438,7 @@ class Timelines():
|
|||
print(tile_file)
|
||||
if self.render_small_tiles:
|
||||
resize = (self.full_tile_w, self.small_tile_h)
|
||||
self.full_tile_image = self.full_tile_image.resize(resize, Image.ANTIALIAS)
|
||||
self.full_tile_image = self.full_tile_image.resize(resize, Image.LANCZOS)
|
||||
tile_file = '%stimeline%s%dp.jpg' % (
|
||||
self.tile_path, mode, self.small_tile_h
|
||||
)
|
||||
|
@ -460,7 +459,7 @@ class Timelines():
|
|||
self.tile_path, line, 'slitscan', self.output_h, index, type
|
||||
)
|
||||
ox.makedirs(os.path.dirname(tile_file))
|
||||
width = self.large_tile_image[mode][line].size[1]
|
||||
width = self.large_tile_image[mode][line].size[0]
|
||||
img = self.large_tile_image[mode][line]
|
||||
if self.output_h != self.large_tile_image[mode][line].size[0]:
|
||||
img = img.resize((width, self.output_h), Image.BICUBIC)
|
||||
|
@ -491,7 +490,7 @@ class Timelines():
|
|||
else:
|
||||
w = self.small_tile_last_w % 60 or 60
|
||||
resize = (w, self.small_tile_h)
|
||||
resized = self.large_tile_image[mode].resize(resize, Image.ANTIALIAS)
|
||||
resized = self.large_tile_image[mode].resize(resize, Image.LANCZOS)
|
||||
paste = (small_tile_x, 0)
|
||||
self.small_tile_image[small_mode].paste(resized, paste)
|
||||
# save small tile
|
||||
|
|
10
setup.py
10
setup.py
|
@ -1,15 +1,14 @@
|
|||
# setup.py
|
||||
# -*- coding: UTF-8 -*-
|
||||
try:
|
||||
|
||||
from setuptools import setup
|
||||
except:
|
||||
from distutils.core import setup
|
||||
|
||||
def get_version():
|
||||
import subprocess
|
||||
rev = subprocess.check_output(['git', 'rev-list', 'HEAD', '--count']).decode().strip()
|
||||
return rev or u'unknown'
|
||||
|
||||
|
||||
setup(name='oxtimelines',
|
||||
version='0.%s' % get_version(),
|
||||
scripts=[
|
||||
|
@ -18,6 +17,11 @@ setup(name='oxtimelines',
|
|||
packages=[
|
||||
'oxtimelines',
|
||||
],
|
||||
install_requires=[
|
||||
'numpy',
|
||||
'ox',
|
||||
'Pillow',
|
||||
],
|
||||
author='0x2620',
|
||||
author_email='0x2620@0x2620.org',
|
||||
url="https://wiki.0x2620.org/wiki/oxtimelines",
|
||||
|
|
Loading…
Reference in a new issue