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