Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -50,8 +50,8 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
|
|
50 |
# Remove the file extension
|
51 |
output_path = video_file.name[:-len(file_extension)]
|
52 |
|
53 |
-
# Add the .
|
54 |
-
output_path += "
|
55 |
|
56 |
# Set the output path to the temp directory
|
57 |
output_path = os.path.join(temp_dir, output_path)
|
@@ -59,7 +59,7 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
|
|
59 |
# Create the temporary file
|
60 |
os.mknod(output_path)
|
61 |
|
62 |
-
ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f
|
63 |
|
64 |
try:
|
65 |
subprocess.run(ffmpeg_command, shell=True, timeout=10)
|
@@ -81,4 +81,4 @@ def convert_video(video_file: File, quality, aspect_ratio, video_url):
|
|
81 |
|
82 |
from gradio import outputs
|
83 |
|
84 |
-
gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio, video_url], outputs=[outputs.Video()]).launch(share=
|
|
|
50 |
# Remove the file extension
|
51 |
output_path = video_file.name[:-len(file_extension)]
|
52 |
|
53 |
+
# Add the .mp4 file extension
|
54 |
+
output_path += ".mp4"
|
55 |
|
56 |
# Set the output path to the temp directory
|
57 |
output_path = os.path.join(temp_dir, output_path)
|
|
|
59 |
# Create the temporary file
|
60 |
os.mknod(output_path)
|
61 |
|
62 |
+
ffmpeg_command = f"ffmpeg -i {video_file} -c:v libx264 -crf {quality} -f mp4 -aspect {aspect_ratio} {output_path}"
|
63 |
|
64 |
try:
|
65 |
subprocess.run(ffmpeg_command, shell=True, timeout=10)
|
|
|
81 |
|
82 |
from gradio import outputs
|
83 |
|
84 |
+
gr.Interface(convert_video, inputs=[video_file, quality, aspect_ratio, video_url], outputs=[outputs.Video()]).launch(share=True)
|