Skip to content

Commit

Permalink
Do not fail dubbing process if subtitles cannot be added
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimas committed Dec 19, 2024
1 parent 5d94655 commit 58db5e9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions open_dubbing/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def embed_subtitles(
video_file: str,
subtitles_files: List[str],
languages_iso_639_3: List[str],
) -> str:
):
filename = ""
with tempfile.NamedTemporaryFile(delete=False) as temp_file:
shutil.copyfile(video_file, temp_file.name)
Expand Down Expand Up @@ -131,14 +131,12 @@ def embed_subtitles(
logging.debug(f"embed_subtitles. Command: {' '.join(cmd)}")

# Run the command using the _run method
self._run(command=cmd, fail=True)
self._run(command=cmd, fail=False)
filename = temp_file.name

if os.path.exists(filename):
os.remove(filename)

return output_file

@staticmethod
def is_ffmpeg_installed():
cmd = ["ffprobe", "-version"]
Expand Down

0 comments on commit 58db5e9

Please sign in to comment.