Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -10,10 +10,10 @@ quality = gr.inputs.Dropdown(choices=["18", "23", "28", "32"], label="Quality",
|
|
10 |
aspect_ratio = gr.inputs.Dropdown(choices=["16:9", "4:3", "3:2", "2:1"], label="Aspect Ratio", default="16:9")
|
11 |
|
12 |
def convert_video(video_file: File, quality, aspect_ratio):
|
13 |
-
output_path = f"{video_file.
|
14 |
|
15 |
temp_dir = tempfile.gettempdir()
|
16 |
-
ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {temp_dir}/{output_path}"
|
17 |
subprocess.run(ffmpeg_command, shell=True)
|
18 |
|
19 |
return components.Video(output_path)
|
|
|
10 |
aspect_ratio = gr.inputs.Dropdown(choices=["16:9", "4:3", "3:2", "2:1"], label="Aspect Ratio", default="16:9")
|
11 |
|
12 |
def convert_video(video_file: File, quality, aspect_ratio):
|
13 |
+
output_path = f"{video_file.name}.m3u8"
|
14 |
|
15 |
temp_dir = tempfile.gettempdir()
|
16 |
+
ffmpeg_command = f"ffmpeg -i {video_file.path} -c:v libx264 -crf {quality} -f hls -aspect {aspect_ratio} {temp_dir}/{output_path}"
|
17 |
subprocess.run(ffmpeg_command, shell=True)
|
18 |
|
19 |
return components.Video(output_path)
|