Skip to content

Video editing with Python

Fix ffmpeg copy to override existing file

osaajani9c392f7829ef
diff --git a/moviepy/video/io/ffmpeg_tools.py b/moviepy/video/io/ffmpeg_tools.py
index a558b10a..5b27e56a 100644
--- a/moviepy/video/io/ffmpeg_tools.py
+++ b/moviepy/video/io/ffmpeg_tools.py
@@ -4,7 +4,6 @@ import os
import re
import subprocess
from pathlib import Path
-from typing import Union
from moviepy.config import FFMPEG_BINARY, FFPLAY_BINARY
from moviepy.decorators import convert_parameter_to_seconds, convert_path_to_string
@@ -213,7 +212,8 @@ def ffmpeg_stabilize_video(
subprocess_call(cmd, logger=logger)
-def ffmpeg_copy(input_file: Union[str, Path], output_file: Union[str, Path]):
+@convert_path_to_string(("inputfile", "outputfile", "output_dir"))
+def ffmpeg_copy(input_file, output_file):
"""
Re-mix a video file using ffmpeg.
This may fix issues with corrupted video file.
@@ -235,9 +235,6 @@ def ffmpeg_copy(input_file: Union[str, Path], output_file: Union[str, Path]):
if not input_path.exists():
raise FileNotFoundError(f"Input file '{input_file}' not found.")
- if output_path.exists():
- raise FileExistsError(f"Output file '{output_file}' already exists.")
-
try:
# Construct the ffmpeg command
command = [