Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DedInc committed May 1, 2021
0 parents commit 6459dd1
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1 align="center">vidspinner - Video uniqualizer.</h1>

<br>

<h1 align="center"> -How to use- </h1>

```python
import vidspinner as vs

vs.unique('input.mp4', 'output.mp4')
```
28 changes: 28 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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',
)
2 changes: 2 additions & 0 deletions vidspinner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from .vidspinner import unique
Binary file added vidspinner/ffmpeg.exe
Binary file not shown.
Binary file added vidspinner/pixel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions vidspinner/vidspinner.py
Original file line number Diff line number Diff line change
@@ -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!')

0 comments on commit 6459dd1

Please sign in to comment.