mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-05-17 08:20:31 +08:00
fixed log format issue
This commit is contained in:
@@ -40,6 +40,7 @@ Last Modified: March 23, 2020
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
|
from . import __version__
|
||||||
from .decoder import VideoDecoder
|
from .decoder import VideoDecoder
|
||||||
from .encoder import VideoEncoder
|
from .encoder import VideoEncoder
|
||||||
from .interpolator import Interpolator
|
from .interpolator import Interpolator
|
||||||
@@ -61,14 +62,13 @@ from tqdm import tqdm
|
|||||||
import cv2
|
import cv2
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
|
|
||||||
VERSION = "5.0.0"
|
|
||||||
|
|
||||||
LEGAL_INFO = """Video2X {}
|
LEGAL_INFO = """Video2X {}
|
||||||
Author: K4YT3X
|
Author: K4YT3X
|
||||||
License: GNU GPL v3
|
License: GNU GPL v3
|
||||||
Github Page: https://github.com/k4yt3x/video2x
|
Github Page: https://github.com/k4yt3x/video2x
|
||||||
Contact: k4yt3x@k4yt3x.com""".format(
|
Contact: k4yt3x@k4yt3x.com""".format(
|
||||||
VERSION
|
__version__
|
||||||
)
|
)
|
||||||
|
|
||||||
UPSCALING_DRIVERS = [
|
UPSCALING_DRIVERS = [
|
||||||
@@ -161,14 +161,6 @@ class Video2X:
|
|||||||
)
|
)
|
||||||
self.decoder.start()
|
self.decoder.start()
|
||||||
|
|
||||||
# in interpolate mode, the frame rate is doubled
|
|
||||||
if mode == "upscale":
|
|
||||||
progress = tqdm(total=total_frames, desc=f"UPSC {input_path.name}")
|
|
||||||
# elif mode == "interpolate":
|
|
||||||
else:
|
|
||||||
frame_rate *= 2
|
|
||||||
progress = tqdm(total=total_frames, desc=f"INTERP {input_path.name}")
|
|
||||||
|
|
||||||
# set up and start encoder thread
|
# set up and start encoder thread
|
||||||
logger.info("Starting video encoder")
|
logger.info("Starting video encoder")
|
||||||
self.encoder = VideoEncoder(
|
self.encoder = VideoEncoder(
|
||||||
@@ -191,7 +183,21 @@ class Video2X:
|
|||||||
process.start()
|
process.start()
|
||||||
self.processor_processes.append(process)
|
self.processor_processes.append(process)
|
||||||
|
|
||||||
|
# set progress bar values based on mode
|
||||||
|
if mode == "upscale":
|
||||||
|
label = "UPSC"
|
||||||
|
|
||||||
|
# in interpolate mode, the frame rate is doubled
|
||||||
|
elif mode == "interpolate":
|
||||||
|
frame_rate *= 2
|
||||||
|
label = "INTERP"
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError(f"unknown mode {mode}")
|
||||||
|
|
||||||
# create progress bar
|
# create progress bar
|
||||||
|
progress = tqdm(total=total_frames, desc=f"{label} {input_path.name}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# wait for jobs in queue to deplete
|
# wait for jobs in queue to deplete
|
||||||
while self.encoder.is_alive() is True:
|
while self.encoder.is_alive() is True:
|
||||||
@@ -414,17 +420,31 @@ def main():
|
|||||||
if os.environ.get("LOGURU_LEVEL") is None:
|
if os.environ.get("LOGURU_LEVEL") is None:
|
||||||
os.environ["LOGURU_LEVEL"] = args.loglevel.upper()
|
os.environ["LOGURU_LEVEL"] = args.loglevel.upper()
|
||||||
|
|
||||||
# set logger format
|
# remove default handler
|
||||||
if os.environ.get("LOGURU_FORMAT") is None:
|
logger.remove(0)
|
||||||
os.environ[
|
|
||||||
"LOGURU_FORMAT"
|
# add new sink with custom handler
|
||||||
] = "<fg 240>{time:HH:mm:ss!UTC}</fg 240> | <level>{level: <8}</level> | <level>{message}</level>"
|
logger.add(
|
||||||
|
sys.stderr,
|
||||||
|
colorize=True,
|
||||||
|
format=(
|
||||||
|
"<green>{time:HH:mm:ss.SSSSSS!UTC}</green> | "
|
||||||
|
"<level>{level: <8}</level> | "
|
||||||
|
"<level>{message}</level>"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
# display version and lawful informaition
|
# display version and lawful informaition
|
||||||
if args.version:
|
if args.version:
|
||||||
print(LEGAL_INFO)
|
print(LEGAL_INFO)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
# print package version and copyright notice
|
||||||
|
logger.opt(colors=True).info(f"<magenta>Video2X {__version__}</magenta>")
|
||||||
|
logger.opt(colors=True).info(
|
||||||
|
"<magenta>Copyright (C) 2018-2022 K4YT3X and contributors.</magenta>"
|
||||||
|
)
|
||||||
|
|
||||||
# initialize upscaler object
|
# initialize upscaler object
|
||||||
video2x = Video2X()
|
video2x = Video2X()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user