Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,16 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
|
|
44 |
if video_file is None:
|
45 |
video_file = Path(video_url)
|
46 |
|
47 |
-
output_path = f"{temp_dir}/{video_file.name}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {output_path}"
|
50 |
|
@@ -57,7 +66,7 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
|
|
57 |
time.sleep(2)
|
58 |
|
59 |
# Return the output file directly
|
60 |
-
return components.Video(output_path
|
61 |
|
62 |
from gradio import outputs
|
63 |
|
|
|
44 |
if video_file is None:
|
45 |
video_file = Path(video_url)
|
46 |
|
47 |
+
output_path = f"{temp_dir}/{video_file.name}"
|
48 |
+
|
49 |
+
# Get the file extension
|
50 |
+
file_extension = video_file.suffix
|
51 |
+
|
52 |
+
# Remove the file extension
|
53 |
+
output_path = output_path[:-len(file_extension)]
|
54 |
+
|
55 |
+
# Add the .m3u8 file extension
|
56 |
+
output_path += ".m3u8"
|
57 |
|
58 |
ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {output_path}"
|
59 |
|
|
|
66 |
time.sleep(2)
|
67 |
|
68 |
# Return the output file directly
|
69 |
+
return components.Video(output_path)
|
70 |
|
71 |
from gradio import outputs
|
72 |
|