Skip to content

Commit

Permalink
bug fix and customizability (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
akai-katto authored Dec 11, 2022
1 parent 7efadfa commit 5d6c9b7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/config_files/output_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ dandere2x_cpp:
evaluator_arg: "mse"

ffmpeg:
pre_process_video:
-hwaccel: auto
convert_video_to_frames:
output_options:
-vf:
- " null"
- 'null'

convert_video_to_gif:
output_options:
Expand Down
3 changes: 2 additions & 1 deletion src/dandere2x/dandere2x_service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from dandere2x.dandere2x_service.core.waifu2x.realsr_ncnn_vulkan import RealSRNCNNVulkan
from dandere2x.dandere2x_service.dandere2x_service_context import Dandere2xServiceContext
from dandere2x.dandere2x_service.dandere2x_service_controller import Dandere2xController
from dandere2x.dandere2xlib.utils.dandere2x_utils import file_exists
from dandere2x.dandere2xlib.utils.dandere2x_utils import file_exists, wait_on_file
from dandere2x.dandere2xlib.wrappers.ffmpeg.progressive_noise_adder import ProgressiveNoiseAdder


Expand Down Expand Up @@ -131,6 +131,7 @@ def __upscale_first_frame(self):

# measure the time to upscale a single frame for printing purposes
one_frame_time = time.time()
wait_on_file(self.context.input_frames_dir + "frame" + str(1) + ".png")
self.waifu2x.upscale_file(
input_image=self.context.input_frames_dir + "frame" + str(1) + ".png",
output_image=self.context.merged_dir + "merged_" + str(1) + ".png")
Expand Down
1 change: 1 addition & 0 deletions src/dandere2x/dandere2xlib/utils/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def resource_path():
else:
return Path(os.path.dirname(os.path.abspath(sys.executable)))


def load_executable_paths_yaml() -> dict:
"""
Load the dandere2x_directories yaml file, but replace all the relative path definitions with absolute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def __init__(self,
self.compressed_quality = compressed_quality

width, height = get_width_height(ffprobe_dir=ffprobe_path, input_video=input_video)
self.cap = FFMpegVideoFrameExtractor(Path(ffmpeg_path), Path(input_video), width, height, block_size,
output_options_original)
self.cap = FFMpegVideoFrameExtractor(Path(ffmpeg_path), Path(input_video), width, height, block_size, output_options_original)

self.ffmpeg_path = load_executable_paths_yaml()['ffmpeg']

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,14 @@ def __init__(self, ffmpeg_binary: Path, input_video: Path, width: int, height: i
block_size=block_size,
output_options_original=output_options_original)

print("pre output options")
options = get_options_from_section(fixed_resolution["ffmpeg"]["pre_process_video"]['output_options'],
options = get_options_from_section(fixed_resolution["ffmpeg"]["convert_video_to_frames"]['output_options'],
ffmpeg_command=True)
for item in options:
extraction_args.append(item)

extraction_args.extend(["-c:v", "rawvideo", "-f", "rawvideo",
"-pix_fmt", "rgb24", "-an", "-"])

pprint(extraction_args)
self.ffmpeg = subprocess.Popen(extraction_args, stdout=subprocess.PIPE)

@property
Expand Down

0 comments on commit 5d6c9b7

Please sign in to comment.