Skip to content

Video editing with Python

Introduced FFMPEG_BINARY in ffmpeg_tools. Fixes critical Windows error.

Zulko00e01d007c22
diff --git a/moviepy/version.py b/moviepy/version.py
index 1b051f89..aa040df2 100644
--- a/moviepy/version.py
+++ b/moviepy/version.py
@@ -1 +1 @@
-__version__ = "0.2.1.8.03"
+__version__ = "0.2.1.8.05"
diff --git a/moviepy/video/io/ffmpeg_tools.py b/moviepy/video/io/ffmpeg_tools.py
index 76e9a39d..09ac330b 100644
--- a/moviepy/video/io/ffmpeg_tools.py
+++ b/moviepy/video/io/ffmpeg_tools.py
@@ -5,6 +5,7 @@ import sys
import subprocess as sp
from moviepy.tools import subprocess_call
+from moviepy.conf import FFMPEG_BINARY
def ffmpeg_movie_from_frames(filename, folder, fps, digits=6):
@@ -13,7 +14,7 @@ def ffmpeg_movie_from_frames(filename, folder, fps, digits=6):
Almost deprecated.
"""
s = "%" + "%02d" % digits + "d.png"
- cmd = ["ffmpeg", "-y", "-f","image2",
+ cmd = [FFMPEG_BINARY, "-y", "-f","image2",
"-r", "%d"%fps,
"-i", os.path.join(folder,folder) + '/' + s,
"-b", "%dk"%bitrate,
@@ -31,7 +32,7 @@ def ffmpeg_extract_subclip(filename, t1, t2, targetname=None):
T1, T2 = [int(1000*t) for t in [t1, t2]]
targetname = name+ "%sSUB%d_%d.%s"(name, T1, T2, ext)
- cmd = ["ffmpeg","-y",
+ cmd = [FFMPEG_BINARY,"-y",
"-i", filename,
"-ss", "%0.2f"%t1,
"-t", "%0.2f"%(t2-t1),
@@ -45,7 +46,7 @@ def ffmpeg_merge_video_audio(video,audio,output, vcodec='copy',
verbose = True):
""" merges video file ``video`` and audio file ``audio`` into one
movie file ``output``. """
- cmd = ["ffmpeg", "-y", "-i", audio,"-i", video,
+ cmd = [FFMPEG_BINARY, "-y", "-i", audio,"-i", video,
"-vcodec", vcodec, "-acodec", acodec, output]
subprocess_call(cmd, verbose = verbose)
@@ -53,7 +54,7 @@ def ffmpeg_merge_video_audio(video,audio,output, vcodec='copy',
def ffmpeg_extract_audio(inputfile,output,bitrate=3000,fps=44100):
""" extract the sound from a video file and save it in ``output`` """
- cmd = ["ffmpeg", "-y", "-i", inputfile, "-ab", "%dk"%bitrate,
+ cmd = [FFMPEG_BINARY, "-y", "-i", inputfile, "-ab", "%dk"%bitrate,
"-ar", "%d"%fps, output]
subprocess_call(cmd)
@@ -61,7 +62,7 @@ def ffmpeg_extract_audio(inputfile,output,bitrate=3000,fps=44100):
def ffmpeg_resize(video,output,size):
""" resizes ``video`` to new size ``size`` and write the result
in file ``output``. """
- cmd= ["ffmpeg", "-i", video, "-vf", "scale=%d:%d"%(res[0], res[1]),
+ cmd= [FFMPEG_BINARY, "-i", video, "-vf", "scale=%d:%d"%(res[0], res[1]),
output]
subprocess_call(cmd)