Spaces:
Build error
Build error
ahmedghani
commited on
Commit
β’
066843c
1
Parent(s):
48a1732
bug fix
Browse files- video_convertor.py +2 -2
video_convertor.py
CHANGED
@@ -16,7 +16,7 @@ class VideoConverter:
|
|
16 |
def load_video(self):
|
17 |
try:
|
18 |
self.video = VideoFileClip(self.input_file)
|
19 |
-
self.audio =
|
20 |
except Exception as e:
|
21 |
raise Exception(f"Error loading video: {e}")
|
22 |
|
@@ -41,7 +41,7 @@ class VideoConverter:
|
|
41 |
raise Exception("No audio stream found in the input file")
|
42 |
|
43 |
try:
|
44 |
-
audio_segment = AudioSegment.from_file(self.input_file, self.
|
45 |
audio_segment.export(output_file, format=format.lower())
|
46 |
print(f"Audio converted to {format} format successfully!")
|
47 |
return output_file
|
|
|
16 |
def load_video(self):
|
17 |
try:
|
18 |
self.video = VideoFileClip(self.input_file)
|
19 |
+
self.audio = self.video.audio if self.video.audio is not None else None
|
20 |
except Exception as e:
|
21 |
raise Exception(f"Error loading video: {e}")
|
22 |
|
|
|
41 |
raise Exception("No audio stream found in the input file")
|
42 |
|
43 |
try:
|
44 |
+
audio_segment = AudioSegment.from_file(self.input_file, self.audio.codec)
|
45 |
audio_segment.export(output_file, format=format.lower())
|
46 |
print(f"Audio converted to {format} format successfully!")
|
47 |
return output_file
|