From f9ffc8eb8667c30539ef1f8e316fd276d0a754ff Mon Sep 17 00:00:00 2001 From: Lokhia Date: Sat, 11 Jun 2022 02:02:04 +0200 Subject: [PATCH] Doing full movie pipeline --- notebooks/audio/gender_identification.py | 6 +++--- notebooks/audio/media_tools.py | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/notebooks/audio/gender_identification.py b/notebooks/audio/gender_identification.py index 54a9562..3005cb2 100644 --- a/notebooks/audio/gender_identification.py +++ b/notebooks/audio/gender_identification.py @@ -89,10 +89,10 @@ def export_to_csv(self, file_path): if __name__ == '__main__': load_dotenv() - path_to_video = os.getenv("path_to_extract", "./") - audio = os.getenv("path_to_audio", "./") + path_to_video = os.getenv("path_to_full_movie", "./") + audio = os.getenv("path_to_full_audio", "./") movie = Movie(path_to_video, audio) - print(movie.dialogues) + # print(movie.dialogues) movie.export_to_csv('./HP4_results.csv') # """Pour convertir en tests :""" # gender_of_time_45 = movie.search_gender_tag(45) # None diff --git a/notebooks/audio/media_tools.py b/notebooks/audio/media_tools.py index b2733f7..e431200 100644 --- a/notebooks/audio/media_tools.py +++ b/notebooks/audio/media_tools.py @@ -12,8 +12,8 @@ def import_as_clip(path_to_video): return mp.VideoFileClip(path_to_video) -def separate_voice_and_music(file): - os.system('spleeter separate -o ../../../ -f "{instrument}/{filename}.{codec}" ' + file) +def separate_voice_and_music(file): # Do not work above 700 seconds + os.system('spleeter separate -d 700.0 -o ../../../ -f "{instrument}/{filename}.{codec}" ' + file) def extract_audio_from_movie(file, extension='.wav'): @@ -27,9 +27,10 @@ def extract_audio_from_movie(file, extension='.wav'): path_to_full_movie = os.getenv("path_to_full_movie", "./") path_to_extract = os.getenv("path_to_extract", "./") path_to_trailer = os.getenv("path_to_trailer", "./") + path_to_full_audio = os.getenv("path_to_full_audio", "./") - extract_audio_from_movie(path_to_full_movie) - # separate_voice_and_music(path_to_extract) + # extract_audio_from_movie(path_to_full_movie) + # separate_voice_and_music(path_to_full_audio) # cut_and_save(path_to_full_movie, 2115, 2491, path_to_extract)