Skip to content

Commit

Permalink
added audio config, fixed re-encoding bug. (#191)
Browse files Browse the repository at this point in the history
* added support for custom audio configerations

* reverted audio migration back to legacy, still allowing config, added console output in workspace for audio migration

* added missing flag

* reformat + removed print statement
  • Loading branch information
akai-katto authored Feb 9, 2021
1 parent 45f3930 commit ff2cb80
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/config_files/output_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ ffmpeg:
-vf:
- ' deband=range=8:blur=false, pp7=qp=2:mode=medium'

migrate_audio:
output_options:
-c: copy
-y: True

waifu2x_ncnn_vulkan:
output_options:
-g: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ def _on_completion(self):

migrate_tracks_contextless(ffmpeg_dir=ffmpeg_path, no_audio=no_audio,
file_dir=self._service_request.input_file,
output_file=self._service_request.output_file)
output_file=self._service_request.output_file,
output_options=self._service_request.output_options,
console_output_dir=self._service_request.workspace)
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ def _on_completion(self):
ffmpeg_path = load_executable_paths_yaml()['ffmpeg']
migrate_tracks_contextless(ffmpeg_dir=ffmpeg_path, no_audio=self.child_request.output_file,
file_dir=self._service_request.input_file,
output_file=self._service_request.output_file)
output_file=self._service_request.output_file,
output_options=self._service_request.output_options,
console_output_dir=self._service_request.workspace)
9 changes: 9 additions & 0 deletions src/dandere2x/dandere2xlib/wrappers/ffmpeg/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,14 @@ def concat_n_videos(ffmpeg_dir: str, temp_file_dir: str, console_output_dir: str


def migrate_tracks_contextless(ffmpeg_dir: str, no_audio: str, file_dir: str, output_file: str,
output_options: dict,
console_output_dir=None):
"""
Add the audio tracks from the original video to the output video.
"""

print("migrate tracks called")

# to remove
def convert(lst):
return ' '.join(lst)
Expand All @@ -258,6 +261,12 @@ def convert(lst):
"-map", "1:t?"
]

options = get_options_from_section(output_options["ffmpeg"]['migrate_audio']['output_options'],
ffmpeg_command=True)

for element in options:
migrate_tracks_command.append(element)

migrate_tracks_command.extend([str(output_file)])

console_output = get_console_output(__name__, console_output_dir)
Expand Down

0 comments on commit ff2cb80

Please sign in to comment.