Skip to content

Video editing with Python

fix lost threads parameter from merge

Florian Zierercf6399d3951c
diff --git a/moviepy/config.py b/moviepy/config.py
index 6dcd46de..24019e38 100644
--- a/moviepy/config.py
+++ b/moviepy/config.py
@@ -7,12 +7,13 @@ except ImportError:
from config_defaults import (FFMPEG_BINARY, IMAGEMAGICK_BINARY)
+
def try_cmd(cmd):
try:
popen_params = {"stdout": sp.PIPE,
"stderr": sp.PIPE,
"stdin": DEVNULL}
-
+
# This was added so that no extra unwanted window opens on windows
# when the child process is created
if os.name == "nt":
@@ -26,7 +27,7 @@ def try_cmd(cmd):
return True, None
-if FFMPEG_BINARY=='auto-detect':
+if FFMPEG_BINARY == 'auto-detect':
if try_cmd(['ffmpeg'])[0]:
FFMPEG_BINARY = 'ffmpeg'
@@ -35,11 +36,11 @@ if FFMPEG_BINARY=='auto-detect':
else:
FFMPEG_BINARY = 'unset'
else:
- success, err = try_cmd(cmd)
+ success, err = try_cmd(FFMPEG_BINARY)
if not success:
raise err
-if IMAGEMAGICK_BINARY=='auto-detect':
+if IMAGEMAGICK_BINARY == 'auto-detect':
if try_cmd(['convert'])[0]:
IMAGEMAGICK_BINARY = 'convert'
@@ -49,7 +50,7 @@ if IMAGEMAGICK_BINARY=='auto-detect':
def get_setting(varname):
- """ Returns the value of a configuration variable. """
+ """ Returns the value of a configuration variable. """
gl = globals()
if varname not in gl.keys():
raise ValueError("Unknown setting %s"%varname)
diff --git a/moviepy/video/io/ffmpeg_writer.py b/moviepy/video/io/ffmpeg_writer.py
index eb770aca..536a5a08 100644
--- a/moviepy/video/io/ffmpeg_writer.py
+++ b/moviepy/video/io/ffmpeg_writer.py
@@ -106,6 +106,10 @@ class FFMPEG_VideoWriter:
cmd.extend([
'-b', bitrate
])
+
+ if threads is not None:
+ cmd.extend(["-threads", str(threads)])
+
if ((codec == 'libx264') and
(size[0] % 2 == 0) and
(size[1] % 2 == 0)):
@@ -119,7 +123,7 @@ class FFMPEG_VideoWriter:
popen_params = {"stdout": DEVNULL,
"stderr": logfile,
"stdin": sp.PIPE}
-
+
# This was added so that no extra unwanted window opens on windows
# when the child process is created
if os.name == "nt":