Spaces:
Paused
Paused
Commit
路
b8713f0
1
Parent(s):
ec0b887
Update app.py
Browse files
app.py
CHANGED
@@ -108,20 +108,11 @@ def process_video(Video, target_language):
|
|
108 |
else:
|
109 |
print(f"{transcript_file} does not exist.")
|
110 |
#transcript_file_abs_path = os.path.abspath(transcript_file)
|
111 |
-
font_size = "24"
|
112 |
-
font_color = "&H00FFFFFF" # White in ARGB
|
113 |
-
outline_color = "&H000000FF" # Black in ARGB
|
114 |
-
outline_size = "2"
|
115 |
-
shadow = "1"
|
116 |
-
margin_v = "10" # Vertical margin from the bottom
|
117 |
-
margin_h = "20" # Horizontal margin from the side
|
118 |
-
|
119 |
-
style_parameters = f"FontSize={font_size},PrimaryColour={font_color},OutlineColour={outline_color},Outline={outline_size},Shadow={shadow},MarginV={margin_v},MarginH={margin_h}"
|
120 |
try:
|
121 |
if target_language_code == 'ja': # 'ja' 茅 o c贸digo de idioma para o japon锚s
|
122 |
-
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={transcript_file}:force_style='FontName=Noto Sans CJK JP,
|
123 |
else:
|
124 |
-
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={transcript_file}:force_style='FontName=Arial Unicode MS
|
125 |
if result.returncode == 0:
|
126 |
print("FFmpeg executado com sucesso.")
|
127 |
else:
|
@@ -140,7 +131,7 @@ iface = gr.Interface(
|
|
140 |
fn=process_video,
|
141 |
inputs=[
|
142 |
gr.Video(),
|
143 |
-
gr.Dropdown(choices=list(google_lang_codes.keys()), label="Target Language for
|
144 |
],
|
145 |
outputs=[
|
146 |
gr.Video(),
|
|
|
108 |
else:
|
109 |
print(f"{transcript_file} does not exist.")
|
110 |
#transcript_file_abs_path = os.path.abspath(transcript_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
try:
|
112 |
if target_language_code == 'ja': # 'ja' 茅 o c贸digo de idioma para o japon锚s
|
113 |
+
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={transcript_file}:force_style='FontName=Noto Sans CJK JP',charenc=UTF-8", "-scodec", "mov_text", "-metadata:s:s:0", "language=jpn", output_video], capture_output=True, text=True)
|
114 |
else:
|
115 |
+
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={transcript_file}:force_style='FontName=Arial Unicode MS'", output_video], capture_output=True, text=True)
|
116 |
if result.returncode == 0:
|
117 |
print("FFmpeg executado com sucesso.")
|
118 |
else:
|
|
|
131 |
fn=process_video,
|
132 |
inputs=[
|
133 |
gr.Video(),
|
134 |
+
gr.Dropdown(choices=list(google_lang_codes.keys()), label="Target Language for Translation", value="English"),
|
135 |
],
|
136 |
outputs=[
|
137 |
gr.Video(),
|