Spaces:
Build error
Build error
Commit
Β·
8278bd0
1
Parent(s):
2adc529
bug fix
Browse files
__pycache__/video_convertor.cpython-38.pyc
DELETED
|
Binary file (2.31 kB)
|
|
|
__pycache__/video_watermark_remover.cpython-38.pyc
DELETED
|
Binary file (3.51 kB)
|
|
|
video_convertor.py
CHANGED
|
@@ -70,11 +70,7 @@ class VideoConverter:
|
|
| 70 |
def load_video(self):
|
| 71 |
try:
|
| 72 |
self.video = VideoFileClip(self.input_file)
|
| 73 |
-
self.audio = self.
|
| 74 |
-
if self.audio is not None:
|
| 75 |
-
self.audio.codec = self.video.audio.codec
|
| 76 |
-
else:
|
| 77 |
-
raise Exception("Error loading audio from video")
|
| 78 |
except Exception as e:
|
| 79 |
raise Exception(f"Error loading video: {e}")
|
| 80 |
|
|
@@ -94,7 +90,10 @@ class VideoConverter:
|
|
| 94 |
def convert_audio(self, output_file, format):
|
| 95 |
if format not in ['mp3', 'wav', 'ogg', 'flac', 'aac']:
|
| 96 |
raise ValueError(f"Unsupported format: {format}")
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
| 98 |
try:
|
| 99 |
audio_segment = AudioSegment.from_file(self.input_file, self.audio.codec)
|
| 100 |
audio_segment.export(output_file, format=format.lower())
|
|
|
|
| 70 |
def load_video(self):
|
| 71 |
try:
|
| 72 |
self.video = VideoFileClip(self.input_file)
|
| 73 |
+
self.audio = AudioFileClip(self.input_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
raise Exception(f"Error loading video: {e}")
|
| 76 |
|
|
|
|
| 90 |
def convert_audio(self, output_file, format):
|
| 91 |
if format not in ['mp3', 'wav', 'ogg', 'flac', 'aac']:
|
| 92 |
raise ValueError(f"Unsupported format: {format}")
|
| 93 |
+
|
| 94 |
+
if self.audio is None:
|
| 95 |
+
raise Exception("No audio stream found in the input file")
|
| 96 |
+
|
| 97 |
try:
|
| 98 |
audio_segment = AudioSegment.from_file(self.input_file, self.audio.codec)
|
| 99 |
audio_segment.export(output_file, format=format.lower())
|