mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-29 22:18:12 +00:00
initial
This commit is contained in:
parent
d569234236
commit
ce8881bfd2
BIN
__pycache__/ffmpeg.cpython-36.pyc
Normal file
BIN
__pycache__/ffmpeg.cpython-36.pyc
Normal file
Binary file not shown.
33
ffmpeg.py
Normal file
33
ffmpeg.py
Normal file
@ -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")
|
26
video2x.py
Normal file
26
video2x.py
Normal file
@ -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")
|
24
waifu2x.py
Normal file
24
waifu2x.py
Normal file
@ -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))
|
Loading…
Reference in New Issue
Block a user