Spaces:
Sleeping
Sleeping
Commit
•
bea947c
1
Parent(s):
c80f760
Cleaned
Browse files- translated_video.py +3 -5
translated_video.py
CHANGED
@@ -55,7 +55,7 @@ def create_translated_video(original_video_path, translated_audio_path, translat
|
|
55 |
with open(srt_file, 'w', encoding='utf-8') as file:
|
56 |
file.write(srt_content)
|
57 |
|
58 |
-
# Write
|
59 |
temp = "./translated/temp.mp4"
|
60 |
video.write_videofile(temp)
|
61 |
|
@@ -63,7 +63,7 @@ def create_translated_video(original_video_path, translated_audio_path, translat
|
|
63 |
ran = random.randint(1000,9999)
|
64 |
final_video_file = os.path.join(output_dir, f"{video_name}{ran}.mp4")
|
65 |
|
66 |
-
# Correct
|
67 |
subtitle_filter_str = f"subtitles='{srt_file}'"
|
68 |
|
69 |
try:
|
@@ -74,6 +74,4 @@ def create_translated_video(original_video_path, translated_audio_path, translat
|
|
74 |
|
75 |
# Remove temp file
|
76 |
os.remove(temp)
|
77 |
-
return final_video_file
|
78 |
-
|
79 |
-
# The rest of your script, if any
|
|
|
55 |
with open(srt_file, 'w', encoding='utf-8') as file:
|
56 |
file.write(srt_content)
|
57 |
|
58 |
+
# Write final video temp file
|
59 |
temp = "./translated/temp.mp4"
|
60 |
video.write_videofile(temp)
|
61 |
|
|
|
63 |
ran = random.randint(1000,9999)
|
64 |
final_video_file = os.path.join(output_dir, f"{video_name}{ran}.mp4")
|
65 |
|
66 |
+
# Correct subtitle filter string for ffmpeg
|
67 |
subtitle_filter_str = f"subtitles='{srt_file}'"
|
68 |
|
69 |
try:
|
|
|
74 |
|
75 |
# Remove temp file
|
76 |
os.remove(temp)
|
77 |
+
return final_video_file
|
|
|
|