Spaces:
Paused
Paused
Commit
路
ec0b887
1
Parent(s):
5bdcc47
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,11 +108,20 @@ 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 |
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'
|
| 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:
|
|
@@ -139,7 +148,7 @@ iface = gr.Interface(
|
|
| 139 |
],
|
| 140 |
live=False,
|
| 141 |
title="VIDEO TRANSCRIPTION AND TRANSLATION",
|
| 142 |
-
description="""This tool was developed by [@artificialguybr](https://twitter.com/artificialguybr) using entirely open-source tools. Special thanks to Hugging Face for the GPU support.""",
|
| 143 |
allow_flagging=False
|
| 144 |
)
|
| 145 |
with gr.Blocks() as demo:
|
|
|
|
| 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,{style_parameters}'", "-scodec", "mov_text", "-metadata:s:s:0", "language=jpn", output_video], capture_output=True, text=True)
|
| 123 |
else:
|
| 124 |
+
result = subprocess.run(["ffmpeg", "-i", Video, "-vf", f"subtitles={transcript_file}:force_style='FontName=Arial Unicode MS,{style_parameters}'", output_video], capture_output=True, text=True)
|
| 125 |
if result.returncode == 0:
|
| 126 |
print("FFmpeg executado com sucesso.")
|
| 127 |
else:
|
|
|
|
| 148 |
],
|
| 149 |
live=False,
|
| 150 |
title="VIDEO TRANSCRIPTION AND TRANSLATION",
|
| 151 |
+
description="""This tool was developed by [@artificialguybr](https://twitter.com/artificialguybr) using entirely open-source tools. Special thanks to Hugging Face for the GPU support. Test the [Video Dubbing](https://huggingface.co/spaces/artificialguybr/video-dubbing) space!""",
|
| 152 |
allow_flagging=False
|
| 153 |
)
|
| 154 |
with gr.Blocks() as demo:
|