Spaces:
Sleeping
Sleeping
kevinwang676
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -395,14 +395,24 @@ restart_markdown = ("""
|
|
395 |
|
396 |
import ffmpeg
|
397 |
|
|
|
|
|
|
|
|
|
398 |
def denoise(input_files):
|
399 |
delete_sliced_files("./", "input_video")
|
400 |
|
401 |
#if os.path.exists("audio_full.wav"):
|
402 |
# os.remove("audio_full.wav")
|
403 |
for video_file in input_files:
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
-
ffmpeg.input(
|
406 |
|
407 |
zip_sliced_files("./", "转换后的音频.zip", "input_video")
|
408 |
|
|
|
395 |
|
396 |
import ffmpeg
|
397 |
|
398 |
+
def save_file_with_new_name(original_file_path, new_file_path):
|
399 |
+
shutil.copyfile(original_file_path, new_file_path)
|
400 |
+
|
401 |
+
|
402 |
def denoise(input_files):
|
403 |
delete_sliced_files("./", "input_video")
|
404 |
|
405 |
#if os.path.exists("audio_full.wav"):
|
406 |
# os.remove("audio_full.wav")
|
407 |
for video_file in input_files:
|
408 |
+
|
409 |
+
name1 = video_file.name
|
410 |
+
file_name_with_extension = name1.split('/')[-1]
|
411 |
+
file_name1 = file_name_with_extension.split('.mp4')[0] + ".wav"
|
412 |
+
|
413 |
+
save_file_with_new_name(video_file.name, file_name1)
|
414 |
|
415 |
+
ffmpeg.input(file_name1).output("input_video" + file_name1 + ".wav", ac=2, ar=44100).run()
|
416 |
|
417 |
zip_sliced_files("./", "转换后的音频.zip", "input_video")
|
418 |
|