Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -75,7 +75,7 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
75 |
output_path = get_output_path(input_path, str(res) + 'p')
|
76 |
|
77 |
ffmpeg_command = [
|
78 |
-
|
79 |
"-vf", f"scale={scale}:force_original_aspect_ratio=decrease,pad=ceil(iw/2)*2:ceil(ih/2)*2",
|
80 |
"-hls_time", "10", "-hls_playlist_type", "vod", "-hls_segment_filename",
|
81 |
str(output_dir / f"{output_path.stem}_%03d.ts"), str(output_path)
|
@@ -91,7 +91,7 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
91 |
|
92 |
# After generating the video files, create links to them
|
93 |
output_links = []
|
94 |
-
for path in
|
95 |
output_links.append(f'<a href="{path}" target="_blank">Download {Path(path).stem}</a>')
|
96 |
|
97 |
output_html = "<br>".join(output_links)
|
@@ -104,7 +104,7 @@ aspect_ratio = gradio.inputs.Dropdown(["16:9", "4:3", "1:1", "3:4", "9:16", "1:1
|
|
104 |
video_url = gradio.inputs.Textbox(lines=1, placeholder="or paste video url here", label="Video URL")
|
105 |
|
106 |
# Update the aspect ratio selection to include the comprehensive list
|
107 |
-
aspect_ratio = gr.inputs.Dropdown(choices=aspect_ratios, label="Aspect Ratio", default="16:9")
|
108 |
|
109 |
interface = gradio.Interface(
|
110 |
fn=convert_video,
|
|
|
75 |
output_path = get_output_path(input_path, str(res) + 'p')
|
76 |
|
77 |
ffmpeg_command = [
|
78 |
+
"ffmpeg", "-i", str(input_path), "-c:v", "libx264", "-crf", str(quality),
|
79 |
"-vf", f"scale={scale}:force_original_aspect_ratio=decrease,pad=ceil(iw/2)*2:ceil(ih/2)*2",
|
80 |
"-hls_time", "10", "-hls_playlist_type", "vod", "-hls_segment_filename",
|
81 |
str(output_dir / f"{output_path.stem}_%03d.ts"), str(output_path)
|
|
|
91 |
|
92 |
# After generating the video files, create links to them
|
93 |
output_links = []
|
94 |
+
for path in output_paths:
|
95 |
output_links.append(f'<a href="{path}" target="_blank">Download {Path(path).stem}</a>')
|
96 |
|
97 |
output_html = "<br>".join(output_links)
|
|
|
104 |
video_url = gradio.inputs.Textbox(lines=1, placeholder="or paste video url here", label="Video URL")
|
105 |
|
106 |
# Update the aspect ratio selection to include the comprehensive list
|
107 |
+
# aspect_ratio = gr.inputs.Dropdown(choices=aspect_ratios, label="Aspect Ratio", default="16:9")
|
108 |
|
109 |
interface = gradio.Interface(
|
110 |
fn=convert_video,
|