app.py
CHANGED
@@ -17,12 +17,13 @@ def combine_video_subtitle(video_file :_TemporaryFileWrapper , subtitle_file):
|
|
17 |
"ffmpeg",
|
18 |
'-i',
|
19 |
subtitle_file.name,
|
20 |
-
'subtites.ass',
|
21 |
-
"
|
22 |
-
|
23 |
-
|
24 |
-
output_file
|
25 |
]
|
|
|
26 |
# Run ffmpeg command to combine video and subtitle
|
27 |
cmd2 = [
|
28 |
"ffmpeg", "-i",
|
@@ -32,9 +33,9 @@ def combine_video_subtitle(video_file :_TemporaryFileWrapper , subtitle_file):
|
|
32 |
]
|
33 |
|
34 |
res = subprocess.run(cmd1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
35 |
-
|
36 |
|
37 |
-
return [
|
38 |
except subprocess.CalledProcessError as e:
|
39 |
error_message = f"An error occurred: {e.returncode}\n{e.stderr.decode()}"
|
40 |
print(error_message)
|
@@ -54,4 +55,4 @@ description = "Combine a video file and a subtitle file using ffmpeg."
|
|
54 |
iface = gr.Interface(fn=combine_video_subtitle, inputs=inputs, outputs=outputs, title=title, description=description)
|
55 |
|
56 |
# Launch the Gradio interface
|
57 |
-
iface.launch()
|
|
|
17 |
"ffmpeg",
|
18 |
'-i',
|
19 |
subtitle_file.name,
|
20 |
+
'subtites.ass',
|
21 |
+
# '&&' ,"ffmpeg",
|
22 |
+
# "-i",
|
23 |
+
# video_file.name, '-vf' ,'ass=subtitle.ass',
|
24 |
+
# output_file
|
25 |
]
|
26 |
+
print(video_file.name )
|
27 |
# Run ffmpeg command to combine video and subtitle
|
28 |
cmd2 = [
|
29 |
"ffmpeg", "-i",
|
|
|
33 |
]
|
34 |
|
35 |
res = subprocess.run(cmd1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
36 |
+
print(res)
|
37 |
|
38 |
+
return [subtitle.ass ,res]
|
39 |
except subprocess.CalledProcessError as e:
|
40 |
error_message = f"An error occurred: {e.returncode}\n{e.stderr.decode()}"
|
41 |
print(error_message)
|
|
|
55 |
iface = gr.Interface(fn=combine_video_subtitle, inputs=inputs, outputs=outputs, title=title, description=description)
|
56 |
|
57 |
# Launch the Gradio interface
|
58 |
+
iface.launch(debug =True)
|