diff --git a/__pycache__/ffmpeg.cpython-36.pyc b/__pycache__/ffmpeg.cpython-36.pyc new file mode 100644 index 0000000..46c0b4a Binary files /dev/null and b/__pycache__/ffmpeg.cpython-36.pyc differ 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))