diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8bd11c3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2021 Vladislav Zenkevich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..5c78aae --- /dev/null +++ b/README.MD @@ -0,0 +1,11 @@ +

vidspinner - Video uniqualizer.

+ +
+ +

-How to use-

+ +```python +import vidspinner as vs + +vs.unique('input.mp4', 'output.mp4') +``` \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..fde37f3 --- /dev/null +++ b/setup.py @@ -0,0 +1,28 @@ +import setuptools + +with open('README.md', 'r', encoding='utf-8') as f: + long_description = f.read() + +setuptools.setup( + name='vidspinner', + version='1.0.0', + author='Maehdakvan', + author_email='visitanimation@google.com', + description='Video uniqualizer.', + long_description=long_description, + long_description_content_type='text/markdown', + url='https://github.com/DedInc/ugents', + project_urls={ + 'Bug Tracker': 'https://github.com/DedInc/vidspinner/issues', + }, + classifiers=[ + 'Programming Language :: Python :: 3', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + ], + packages=['vidspinner'], + include_package_data = True, + install_requires = ['Pillow>=8.0'], + data_files = [('vidspinner', ['vidspinner/ffmpeg.exe', 'vidspinner/pixel.png'])], + python_requires='>=3.6', +) \ No newline at end of file diff --git a/vidspinner/__init__.py b/vidspinner/__init__.py new file mode 100644 index 0000000..0bd40dc --- /dev/null +++ b/vidspinner/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from .vidspinner import unique \ No newline at end of file diff --git a/vidspinner/ffmpeg.exe b/vidspinner/ffmpeg.exe new file mode 100644 index 0000000..0ac4671 Binary files /dev/null and b/vidspinner/ffmpeg.exe differ diff --git a/vidspinner/pixel.png b/vidspinner/pixel.png new file mode 100644 index 0000000..e61b9ec Binary files /dev/null and b/vidspinner/pixel.png differ diff --git a/vidspinner/vidspinner.py b/vidspinner/vidspinner.py new file mode 100644 index 0000000..13a7c73 --- /dev/null +++ b/vidspinner/vidspinner.py @@ -0,0 +1,36 @@ +from PIL import Image +from random import randint as rnt +from os.path import dirname, abspath, join, exists +from os import remove, system +from multiprocessing import cpu_count as cpu + +def genPixel(): + print('Generating pixel...') + cdir = dirname(abspath(__file__)) + img = Image.open(join(cdir, 'pixel.png')) + img = img.convert('RGBA') + datas = img.getdata() + + newData = [] + for item in datas: + if item[0] == 255 and item[1] == 255 and item[2] == 255: + newData.append((255, 255, 255, 0)) + else: + if item[0] > 150: + newData.append((rnt(rnt(0, 150), rnt(150, 255)), rnt(rnt(0, 150), rnt(150, 255)), rnt(rnt(0, 150), rnt(150, 255)), 255)) + else: + newData.append(item) + + img.putdata(newData) + img.save(join(cdir, 'gpixel.png'), 'PNG') + print('Generated!') + +def unique(input, output): + if not exists(input): + print('Video is not exists!') + else: + genPixel() + cdir = dirname(abspath(__file__)) + system(cdir + "\\ffmpeg -i \"{}\" -vf \"movie=\\'{}\\' [logo]; [in][logo] overlay=0:0 [out]\" -y -threads {} -qscale 0 \"{}\"".format(input, cdir.replace('\\', '\\\\') + '\\\\gpixel.png', cpu(), output)) + remove(join(cdir, 'gpixel.png')) + print('Video has been uniqualized!') \ No newline at end of file