TDN-M commited on
Commit
917ca4c
·
verified ·
1 Parent(s): 5b6c8ca

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +0 -8
utils.py CHANGED
@@ -10,19 +10,11 @@ def check_file_exists(file_path):
10
  raise FileNotFoundError(f"Tệp {file_path} không tồn tại.")
11
 
12
  # Đường dẫn đầy đủ tới các file
13
- video_file = "input/video.mp4"
14
  bgm_file = "data/bg_music.mp3"
15
  output_path = "output/final_video.mp4"
16
 
17
- check_file_exists(video_file)
18
  check_file_exists(bgm_file)
19
 
20
- video = VideoFileClip(video_file)
21
- bgm = AudioFileClip(bgm_file).subclip(0, video.duration)
22
- final_audio = CompositeAudioClip([video.audio, bgm])
23
- final_video = video.set_audio(final_audio)
24
- final_video.write_videofile(output_path, audio_codec="aac")
25
-
26
  def get_pexels_video(query):
27
  api_key = os.getenv('Pexels_API_KEY')
28
  if not api_key:
 
10
  raise FileNotFoundError(f"Tệp {file_path} không tồn tại.")
11
 
12
  # Đường dẫn đầy đủ tới các file
 
13
  bgm_file = "data/bg_music.mp3"
14
  output_path = "output/final_video.mp4"
15
 
 
16
  check_file_exists(bgm_file)
17
 
 
 
 
 
 
 
18
  def get_pexels_video(query):
19
  api_key = os.getenv('Pexels_API_KEY')
20
  if not api_key: