From ce8881bfd2e54075855076659f8d9f8af923f0ca Mon Sep 17 00:00:00 2001 From: K4YT3X Date: Sat, 24 Feb 2018 13:34:00 -0500 Subject: [PATCH] initial --- __pycache__/ffmpeg.cpython-36.pyc | Bin 0 -> 1484 bytes ffmpeg.py | 33 ++++++++++++++++++++++++++++++ video2x.py | 26 +++++++++++++++++++++++ waifu2x.py | 24 ++++++++++++++++++++++ 4 files changed, 83 insertions(+) create mode 100644 __pycache__/ffmpeg.cpython-36.pyc create mode 100644 ffmpeg.py create mode 100644 video2x.py create mode 100644 waifu2x.py diff --git a/__pycache__/ffmpeg.cpython-36.pyc b/__pycache__/ffmpeg.cpython-36.pyc new file mode 100644 index 0000000000000000000000000000000000000000..46c0b4a106e89bc4f7b4abeb8d1999e69244a7ea GIT binary patch literal 1484 zcmb7EL2uhO6qaPicGS29+5#H}tl*^w1C^B6UNHp2kRV-qSZf4mF|+~-LKUfmnIvi? zZP;0MO8>xq#jx!k>Dtr&!cKdSvJ$7=r4;x`kx!5B`@Tm_hC~0azkiS4b{yw}v(ez) zIe@MofMHJTFqe6`8@taO)?wZE4(ncevB$iZ&S>lW4}X>ve4jjh`r`P9XXGePwDu3@ z=2WVE^5gW)tI2EsNn$uTQXB>bp8OpdPal!-?%ucl^F$l+LNbwwPxkyLT&GG@M#yrX zygC({q!^x@CMC3xij={xTEohE~@-AnB{Y~hG!*;McgWh*DNh%pnNh+%qiA+(+Xl|;x36ePzGE9xQ*tB*P98A(CzuK`s{#&AtWvvcD%U>RB# zZeOvmiT$v}E{H9mFj)w!#73^7ngFnCK?4o{6~p15u|@^nAm5dqBi91@IOAajsI({> z70E{8t%^4sW}^Y#wGwKU(%PrAkZhjge23Cs=1Jb{s2&7Tx6tgM8KOay8^_yn!a`8U r!(Hea%WU8cI?ZF(;coRQWiq9-!Gg~J7o{G2*W~g&9%g?qT?q9bkHK9F literal 0 HcmV?d00001 diff --git a/ffmpeg.py b/ffmpeg.py new file mode 100644 index 0000000..8a9e3cd --- /dev/null +++ b/ffmpeg.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Name: FFMPEG Class +Author: K4YT3X +Date Created: Feb 24, 2018 +Last Modified: Feb 24, 2018 + +Description: This class handles all FFMPEG related +operations. + +Version 1.0 +""" + +import os + + +class FFMPEG: + + def __init__(self): + pass + + def strip_frames(self, videoin, outpath): + os.system("ffmpeg -i {} -r 1/1 {}/extracted_%0d.png".format(videoin, outpath)) + + def extract_audio(self, videoin, outpath): + os.system("ffmpeg -i {} -vn -acodec copy {}/output-audio.aac".format(videoin, outpath)) + + def to_vid(self, framerate, resolution, folder): + os.system("ffmpeg -r {} -f image2 -s {} -i {}/extracted_%d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4".format(framerate, resolution, folder)) + + def pressin_audio(self, videoin): + os.system("ffmpeg -i {} -i audio.mp3 -codec copy -shortest output.mp4") diff --git a/video2x.py b/video2x.py new file mode 100644 index 0000000..82d7cdb --- /dev/null +++ b/video2x.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Name: Video2x Controller +Author: K4YT3X +Date Created: Feb 24, 2018 +Last Modified: Feb 24, 2018 + +Description: This is the main controller for Video2x + +Version 1.0 +""" + +from ffmpeg import FFMPEG +from waifu2x import WAIFU2X +import os + +fm = FFMPEG() +w2 = WAIFU2X() +if not os.path.isdir("frames"): + os.mkdir("frames") +fm.strip_frames("testf.mp4", "frames") + +if not os.path.isdir("upscaled"): + os.mkdir("upscaled") +w2.upscale("frames", "upscaled") diff --git a/waifu2x.py b/waifu2x.py new file mode 100644 index 0000000..2cc5246 --- /dev/null +++ b/waifu2x.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Name: FFMPEG Class +Author: K4YT3X +Date Created: Feb 24, 2018 +Last Modified: Feb 24, 2018 + +Description: This class controls waifu2x +engine + +Version 1.0 +""" + +import os + + +class WAIFU2X: + + def __init__(self): + pass + + def upscale(self, factor, folderin, folderout): + os.system("waifu2x-caffe-cui.exe -i {} -o {}".format(folderin, folderout))