Video editing with Python
Rename to ffmpeg_copy, fix typing for python 3.9, fix path to ffmpeg
osaajani1dfed8a94e52
diff --git a/docs/conf.py b/docs/conf.pyindex b0d31a73..f5bc8c6d 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -47,7 +47,8 @@ master_doc = "index"# General information about the project.project = "MoviePy"-copyright = "2024, Zulko - MIT"+copyright = "2025, Zulko - MIT"+version = "%VERSION%"# The version info for the project you're documenting, acts as replacement for# |version| and |release|, also used in various other places throughout thediff --git a/moviepy/video/re_mux.py b/moviepy/video/tools/ffmpeg_copy.pysimilarity index 78%rename from moviepy/video/re_mux.pyrename to moviepy/video/tools/ffmpeg_copy.pyindex 3e415e0a..207b2776 100644--- a/moviepy/video/re_mux.py+++ b/moviepy/video/tools/ffmpeg_copy.py@@ -1,13 +1,17 @@-"""Module contains a function to re-encode a video file using ffmpeg."""+"""Module contains a function to copy a video file using ffmpeg without re-encoding.+This can be useful for fixing issues with corrupted video files.+"""import subprocessfrom pathlib import Pathfrom typing import Union+from moviepy.config import FFMPEG_BINARY-def remux_video(input_file: Union[str, Path], output_file: Union[str, Path]):++def ffmpeg_copy(input_file: Union[str, Path], output_file: Union[str, Path]):"""- Re-mux a video file using ffmpeg.+ Re-mix a video file using ffmpeg.This may fix issues with corrupted video file.Parameters@@ -33,7 +37,7 @@ def remux_video(input_file: Union[str, Path], output_file: Union[str, Path]):try:# Construct the ffmpeg commandcommand = [- "ffmpeg",+ FFMPEG_BINARY,"-i",str(input_path),"-c",diff --git a/tests/test_VideoFileClip.py b/tests/test_VideoFileClip.pyindex a36fbeba..2f2028ec 100644--- a/tests/test_VideoFileClip.py+++ b/tests/test_VideoFileClip.py@@ -3,14 +3,13 @@import copyimport osfrom pathlib import Path-from tempfile import TemporaryDirectoryimport pytestfrom moviepy.video.compositing.CompositeVideoClip import clips_arrayfrom moviepy.video.io.errors import VideoCorruptedErrorfrom moviepy.video.io.VideoFileClip import VideoFileClip-from moviepy.video.re_mux import remux_video+from moviepy.video.tools.ffmpeg_copy import ffmpeg_copyfrom moviepy.video.VideoClip import ColorClip@@ -110,11 +109,10 @@ def test_no_duration_raise_io_error():VideoFileClip("media/no_duration.webm")-def test_no_duration_re_encode_can_be_opened():- with TemporaryDirectory() as temp_dir:- target = Path(temp_dir).joinpath("re_encoded.webm")- remux_video("media/no_duration.webm", target)- VideoFileClip(target)+def test_no_duration_re_encode_can_be_opened(util):+ target = Path(util.TMP_DIR).joinpath("re_encoded.webm")+ ffmpeg_copy("media/no_duration.webm", target)+ VideoFileClip(target)if __name__ == "__main__":