Last active
January 3, 2025 01:01
-
-
Save thewh1teagle/e1223bff506bda0665f45a9f5c1e309f to your computer and use it in GitHub Desktop.
Fix subtitles in Hebrew and embed subtitles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
with open(sys.argv[1], 'r', encoding='utf-8') as file: | |
content = file.read() | |
lines = [] | |
for line in content.splitlines(): | |
if line.startswith('?') or line.startswith('<i>?'): | |
line = line.replace('?', '') | |
line = line.replace('<i>?', '<i>') | |
lines.append(line) | |
with open(sys.argv[2], 'w', encoding='utf-8') as file: | |
for line in lines: | |
file.write(line + '\n') | |
print("SRT file has been successfully fixed!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
ffmpeg -i input.mp4 -f srt -i heb-utf8.srt -map 0:0 -map 0:1 -map 1:0 -c:v copy -c:a copy -c:s mov_text output.mp4 | |
""" | |
import sys | |
with open(sys.argv[1], 'r', encoding='windows-1255') as file: | |
content = file.read() | |
with open(sys.argv[2], 'w', encoding='utf-8') as file: | |
file.write(content) | |
print("SRT file has been successfully converted to UTF-8!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment