mirror of
https://github.com/Escartem/AnimeWwise.git
synced 2026-06-05 07:50:23 +08:00
ogg and mp3 support
This commit is contained in:
41
extract.py
41
extract.py
@@ -398,8 +398,15 @@ class WwiseExtract:
|
|||||||
temp_dir.cleanup()
|
temp_dir.cleanup()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# mp3 & ogg
|
||||||
|
files = [os.path.join(os.path.dirname(file), f'{os.path.basename(file).split(".")[0]}.wav') for file in files]
|
||||||
new_input = output_folder
|
new_input = output_folder
|
||||||
# TODO: add mp3 and ogg
|
output_folder = output
|
||||||
|
|
||||||
|
self.extract_ffmpeg(new_input, files, output_folder, _format)
|
||||||
|
|
||||||
|
temp_dir.cleanup()
|
||||||
|
return
|
||||||
|
|
||||||
def extract_wem(self, _input, files, output, progress):
|
def extract_wem(self, _input, files, output, progress):
|
||||||
print(": Extracting audio as wem")
|
print(": Extracting audio as wem")
|
||||||
@@ -444,6 +451,38 @@ class WwiseExtract:
|
|||||||
]
|
]
|
||||||
|
|
||||||
call(args)
|
call(args)
|
||||||
|
|
||||||
|
def extract_ffmpeg(self, _input, files, output, _format):
|
||||||
|
print(f": Converting audio to {_format}")
|
||||||
|
|
||||||
|
encoders = {
|
||||||
|
"mp3": "libmp3lame",
|
||||||
|
"ogg": "libvorbis"
|
||||||
|
}
|
||||||
|
|
||||||
|
encoder = encoders[_format]
|
||||||
|
|
||||||
|
pos = 0
|
||||||
|
for file in files:
|
||||||
|
pos += 1
|
||||||
|
self.update_progress(pos, len(files), 3)
|
||||||
|
|
||||||
|
filename = f'{os.path.basename(file).split(".")[0]}.{_format}'
|
||||||
|
filepath = os.path.join(output, os.path.dirname(file), filename)
|
||||||
|
os.makedirs(os.path.dirname(filepath), exist_ok=True)
|
||||||
|
|
||||||
|
args = [
|
||||||
|
path("tools/ffmpeg/ffmpeg.exe"),
|
||||||
|
"-i",
|
||||||
|
os.path.join(_input, file),
|
||||||
|
"-acodec",
|
||||||
|
encoder,
|
||||||
|
"-b:a",
|
||||||
|
"192k", # 192|4
|
||||||
|
filepath
|
||||||
|
]
|
||||||
|
|
||||||
|
call(args)
|
||||||
|
|
||||||
### other ###
|
### other ###
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user