Princeaka commited on
Commit
4fe5d8a
·
verified ·
1 Parent(s): 9df8bbb

Update videogenerator.py

Browse files
Files changed (1) hide show
  1. videogenerator.py +19 -18
videogenerator.py CHANGED
@@ -154,25 +154,26 @@ class VideoGenerator:
154
  raise
155
  return out_path
156
 
157
- def _merge_audio_video(self, video_path, audio_path, out_path):
158
- if not FFMPEG_AVAILABLE:
159
- raise RuntimeError("ffmpeg-python not available")
160
-
161
- try:
162
- video_in = ffmpeg.input(video_path)
163
- audio_in = ffmpeg.input(audio_path)
164
- (
165
- ffmpeg
166
- .output(video_in, audio_in, out_path, vcodec='libx264', acodec='aac', shortest=None)
167
- .overwrite_output()
168
- .run(quiet=True, capture_stdout=True, capture_stderr=True)
169
- )
170
- logger.info(f"Merged video and audio into {out_path}")
171
- except Exception as e:
172
- logger.error(f"Failed to merge audio and video: {e}")
173
- raise
 
 
174
 
175
- return out_path
176
 
177
 
178
  # ---------------- Enhancement Modules ----------------
 
154
  raise
155
  return out_path
156
 
157
+ def _merge_audio_video(self, video_path, audio_path, out_path):
158
+ if not FFMPEG_AVAILABLE:
159
+ raise RuntimeError("ffmpeg-python not available")
160
+
161
+ try:
162
+ video_in = ffmpeg.input(video_path)
163
+ audio_in = ffmpeg.input(audio_path)
164
+ (
165
+ ffmpeg
166
+ .output(video_in, audio_in, out_path, vcodec='libx264', acodec='aac', shortest=None)
167
+ .overwrite_output()
168
+ .run(quiet=True, capture_stdout=True, capture_stderr=True)
169
+ )
170
+ logger.info(f"Merged video and audio into {out_path}")
171
+ except Exception as e:
172
+ logger.error(f"Failed to merge audio and video: {e}")
173
+ raise
174
+
175
+ return out_path
176
 
 
177
 
178
 
179
  # ---------------- Enhancement Modules ----------------