Video editing with Python
changed to_videofile->write_videofile etc. Factorized verbose_print
Valentinc2c59537a1d9
diff --git a/docs/crash_course/crash_course.rst b/docs/crash_course/crash_course.rstindex baee5bd7..1308b7b4 100644--- a/docs/crash_course/crash_course.rst+++ b/docs/crash_course/crash_course.rst@@ -31,7 +31,7 @@ In a typical MoviePy script, you load some clips from video files, then modify tvideo = CompositeVideoClip([clip, txt_clip])# Write the result to a file- video.to_videofile("myHolidays_edited.avi",fps=24, codec='mpeg4')+ video.write_videofile("myHolidays_edited.avi",fps=24, codec='mpeg4')What powers MoviePy@@ -149,9 +149,9 @@ Note that the ``fps`` can be any number, independently of the ``fps`` of your diTo write a clip as a video file, use ::- myClip.to_videofile("myEditedMovie.avi") # default: codec 'libx264' fps 24- myClip.to_videofile("myEditedMovie.avi",fps=15, codec='mpeg4')- myClip.to_videofile("myEditedMovie.avi",audio=False) # don't render the audio.+ myClip.write_videofile("myEditedMovie.avi") # default: codec 'libx264' fps 24+ myClip.write_videofile("myEditedMovie.avi",fps=15, codec='mpeg4')+ myClip.write_videofile("myEditedMovie.avi",audio=False) # don't render the audio.Alternatively you can also save a video clip as an animated GIF with ::@@ -176,7 +176,7 @@ The second important objects of MoviePy are the audio clips. If ``myHolidays.mp4clip = VideoFileClip('myHolidays.mp4')-will create a clip with a ``clip.audio`` attribute which is an audio clip. This is the sound that you will hear if you render the clip with ``clip.preview`` or ``clip.to_videofile``. You can also create an audio clip from a sound file and then attach it to a video clip: ::+will create a clip with a ``clip.audio`` attribute which is an audio clip. This is the sound that you will hear if you render the clip with ``clip.preview`` or ``clip.write_videofile``. You can also create an audio clip from a sound file and then attach it to a video clip: ::audio = AudioFileClip('mySong.wav')video = VideoFileClip('myHolidays.mp4').set_audio(audio)diff --git a/examples/compo_from_image.py b/examples/compo_from_image.pyindex 64bb0a9c..47ad19aa 100644--- a/examples/compo_from_image.py+++ b/examples/compo_from_image.py@@ -19,13 +19,13 @@ clips = [VideoFileClip(n, audio=False).subclip(18,22) for n in"../../videos/grsm_0005.mov"]]# fit each clip into its region-comp_clips = [c.resize(r.size).\- set_mask(r.mask).\- set_pos(r.screenpos)+comp_clips = [c.resize(r.size)+ .set_mask(r.mask)+ .set_pos(r.screenpos)for c,r in zip(clips,regions)]cc = CompositeVideoClip(comp_clips,im.size)-cc.resize(0.6).to_videofile("../../bigcompo.avi")+cc.resize(0.6).write_videofile("../../composition.mp4")# Note that this particular composition takes quite a long time of# rendering (about 20s on my computer for just 4s of video).diff --git a/examples/example_with_sound.py b/examples/example_with_sound.pyindex 87231b61..38cd4cf4 100644--- a/examples/example_with_sound.py+++ b/examples/example_with_sound.py@@ -57,4 +57,4 @@ cc = CompositeVideoClip([clip_right.set_pos('right').volumex(0.4),clip_left.set_pos('left').volumex(0.4)],size = (W,H))#cc.preview()-cc.to_videofile("../../biphone3.avi",fps=24, codec='mpeg4')+cc.write_videofile("../../biphone3.avi",fps=24, codec='mpeg4')diff --git a/examples/headblur.py b/examples/headblur.pyindex 27963b49..49c3e450 100644--- a/examples/headblur.py+++ b/examples/headblur.py@@ -48,4 +48,4 @@ final = concatenate([clip_blurred,txt.set_duration(3)]).\# We write the result to a file. Here we raise the bitrate so that# the final video is not too ugly.-final.to_videofile('../../blurredChaplin.avi', bitrate="3000k")+final.write_videofile('../../blurredChaplin.avi', bitrate="3000k")diff --git a/examples/logo.py b/examples/logo.pyindex 2886f601..31ecf7a8 100644--- a/examples/logo.py+++ b/examples/logo.py@@ -25,4 +25,4 @@ shade.mask = VideoClip(ismask=True, get_frame = mask_frame)cc = CompositeVideoClip([im.set_pos(2*["center"]),shade],size = moviesize)-cc.subclip(0,duration).to_videofile("moviepy_logo.avi",fps=24)+cc.subclip(0,duration).write_videofile("moviepy_logo.avi",fps=24)diff --git a/examples/masked_credits.py b/examples/masked_credits.pyindex 3a1c92c1..ff8ab71f 100644--- a/examples/masked_credits.py+++ b/examples/masked_credits.py@@ -2,10 +2,10 @@ from moviepy.editor import *from moviepy.video.tools.credits import credits1# Load the mountains clip, cut it, slow it down, make it look darker-clip = VideoFileClip('../../videos/badl-0001.mov', audio=False).\- subclip(37,46).\- speedx( 0.4).\- fx( vfx.colorx, 0.7)+clip = (VideoFileClip('../../videos/badl-0001.mov', audio=False)+ .subclip(37,46)+ .speedx( 0.4)+ .fx( vfx.colorx, 0.7))# Save the first frame to later make a mask with GIMP (only once)#~ clip.save_frame('../../credits/mountainMask2.png')@@ -24,4 +24,4 @@ final = CompositeVideoClip([clip,scrolling_credits,clip.set_mask(mountainmask)])-final.subclip(8,10).to_videofile("../../credits_mountains.avi")+final.subclip(8,10).write_videofile("../../credits_mountains.avi")diff --git a/examples/moving_letters.py b/examples/moving_letters.pyindex 02bfb270..95e9b453 100644--- a/examples/moving_letters.py+++ b/examples/moving_letters.py@@ -60,6 +60,6 @@ clips = [ CompositeVideoClip( moveLetters(letters,funcpos),# WE CONCATENATE EVERYTHING AND WRITE TO A FILE-concatenate(clips).to_videofile('../../coolTextEffects.avi',+concatenate(clips).write_videofile('../../coolTextEffects.avi',fps=25, codec='mpeg4')diff --git a/examples/painting_effect.py b/examples/painting_effect.pyindex 8bfb2e92..f74470d8 100644--- a/examples/painting_effect.py+++ b/examples/painting_effect.py@@ -16,16 +16,16 @@ clip_after = charade.coreader().subclip(tfreeze ,tfreeze +2)# THE FRAME TO FREEZEim_freeze = charade.to_ImageClip(tfreeze)-painting = charade.fx( vfx.painting, saturation = 1.6,black = 0.006).\- to_ImageClip(tfreeze)+painting = (charade.fx( vfx.painting, saturation = 1.6,black = 0.006)+ .to_ImageClip(tfreeze)txt = TextClip('Audrey',font='Amiri-regular',fontsize=35)-painting_txt = CompositeVideoClip([painting,txt.set_pos((10,180))]).\- add_mask().\- set_duration(3).\- crossfadein( 0.5).\- crossfadeout( 0.5)+painting_txt = (CompositeVideoClip([painting,txt.set_pos((10,180))])+ .add_mask()+ .set_duration(3)+ .crossfadein( 0.5)+ .crossfadeout( 0.5))# FADEIN/FADEOUT EFFECT ON THE PAINTED IMAGE@@ -37,5 +37,5 @@ final_clip = concatenate([ clip_before,painting_fading.set_duration(3),clip_after])-final_clip.to_videofile('../../audrey.avi',fps=charade.fps,+final_clip.write_videofile('../../audrey.avi',fps=charade.fps,codec = "mpeg4", audio_bitrate="3000k")diff --git a/examples/soundtrack.py b/examples/soundtrack.pyindex bcc19068..1def1c2e 100644--- a/examples/soundtrack.py+++ b/examples/soundtrack.py@@ -14,5 +14,5 @@ movie = VideoFileClip("../../videos/dam.mov").\#~ movie.audio = movie.audio.set_duration(movie.duration)-movie.to_videofile("../../test_soundtrack.avi", codec="mpeg4")+movie.write_videofile("../../test_soundtrack.avi", codec="mpeg4")diff --git a/examples/star_worms.py b/examples/star_worms.pyindex b4bf9719..d58468e0 100644--- a/examples/star_worms.py+++ b/examples/star_worms.py@@ -100,7 +100,7 @@ final = CompositeVideoClip([# WRITE TO A FILE-final.set_duration(8).to_videofile("starworms.avi", fps=5)+final.set_duration(8).write_videofile("starworms.avi", fps=5)# This script is heavy (30s of computations to render 8s of video)@@ -175,5 +175,5 @@ annotated_clips = [ annotate(clip,text) for clip,text in [# Concatenate and write to a file-concatenate(annotated_clips).to_videofile('tutorial.avi', fps=5)+concatenate(annotated_clips).write_videofile('tutorial.avi', fps=5)diff --git a/examples/the_end.py b/examples/the_end.pyindex 0f367b3a..baa11ead 100644--- a/examples/the_end.py+++ b/examples/the_end.py@@ -20,4 +20,4 @@ the_end = TextClip("The End", font="Amiri-bold", color="white",final = CompositeVideoClip([the_end.set_pos('center'),clip],size =clip.size)-final.to_videofile("../../theEnd.avi")+final.write_videofile("../../theEnd.avi")diff --git a/examples/ukulele_concerto.py b/examples/ukulele_concerto.pyindex 5fe0d2a0..345d1ec7 100644--- a/examples/ukulele_concerto.py+++ b/examples/ukulele_concerto.py@@ -39,4 +39,4 @@ txt_mov = txt_col.set_pos( lambda t: (max(w/30,int(w-0.5*w*t)),# FINAL ASSEMBLYfinal = CompositeVideoClip([ukulele,txt_mov,piano])-final.subclip(0,5).to_videofile("../../ukulele.avi",fps=24,codec='libx264')+final.subclip(0,5).write_videofile("../../ukulele.avi",fps=24,codec='libx264')diff --git a/moviepy/audio/AudioClip.py b/moviepy/audio/AudioClip.pyindex c3875627..65f5f99e 100644--- a/moviepy/audio/AudioClip.py+++ b/moviepy/audio/AudioClip.py@@ -1,18 +1,12 @@-import sys-from copy import copyimport numpy as npfrom moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowritefrom moviepy.decorators import requires_duration+from moviepy.tools import deprecated_version_offrom moviepy.Clip import Clip-# optimize range in function of Python's version-if sys.version_info < (3,):- range = xrange--class AudioClip(Clip):""" Base class for audio clips.@@ -89,7 +83,7 @@ class AudioClip(Clip):@requires_duration- def to_audiofile(self,filename, fps=44100, nbytes=2,+ def write_audiofile(self,filename, fps=44100, nbytes=2,buffersize=2000, codec='libvorbis',bitrate=None, write_logfile=False, verbose=True):""" Writes an audio file from the AudioClip.@@ -131,6 +125,12 @@ class AudioClip(Clip):codec=codec, bitrate=bitrate, write_logfile=write_logfile,verbose=verbose)+###+#+# The to_audiofile method is replaced by the more explicit write_audiofile.+AudioClip.to_audiofile = deprecated_version_of(AudioClip.write_audiofile,+ 'to_audiofile')+###class AudioArrayClip(AudioClip):"""diff --git a/moviepy/audio/io/ffmpeg_audiowriter.py b/moviepy/audio/io/ffmpeg_audiowriter.pyindex 3f834d6e..84298420 100644--- a/moviepy/audio/io/ffmpeg_audiowriter.py+++ b/moviepy/audio/io/ffmpeg_audiowriter.py@@ -1,6 +1,4 @@-from __future__ import division-import sysimport numpy as npimport subprocess as sp@@ -14,7 +12,9 @@ from tqdm import tqdmfrom moviepy.conf import FFMPEG_BINARYfrom moviepy.decorators import requires_duration-from moviepy.tools import sys_write_flush+from moviepy.tools import verbose_print++class FFMPEG_AudioWriter:"""@@ -135,16 +135,13 @@ def ffmpeg_audiowrite(clip, filename, fps, nbytes, buffersize,A function that wraps the FFMPEG_AudioWriter to write an AudioClipto a file."""-- def verbose_print(s):- if verbose: sys_write_flush(s)if write_logfile:logfile = open(filename + ".log", 'w+')else:logfile = None- verbose_print("Writing audio in %s\n"%filename)+ verbose_print(verbose, "Writing audio in %s\n"%filename)writer = FFMPEG_AudioWriter(filename, fps, nbytes, clip.nchannels,codec=codec, bitrate=bitrate,@@ -170,4 +167,4 @@ def ffmpeg_audiowrite(clip, filename, fps, nbytes, buffersize,if write_logfile:logfile.close()- verbose_print("Done writing Audio in %s !\n"%filename)+ verbose_print(verbose, "Done writing Audio in %s !\n"%filename)diff --git a/moviepy/tools.py b/moviepy/tools.pyindex ff5fd6fd..7278c38c 100644--- a/moviepy/tools.py+++ b/moviepy/tools.py@@ -4,23 +4,25 @@ Misc. useful functions that can be used at many places in the program.import subprocess as spimport sys+import warningsdef sys_write_flush(s):- """ writes and flushes without delay a text in the console """+ """ Writes and flushes without delay a text in the console """sys.stdout.write(s)sys.stdout.flush()+def verbose_print(verbose, s):+ """ Only prints s (with sys_write_flush) if verbose is True."""+ if verbose:+ sys_write_flush(s)++def subprocess_call(cmd, verbose=True, errorprint=True):- """- executes the subprocess command- """-- def verboseprint(s):- if verbose: sys_write_flush(s)-- verboseprint( "\nMoviePy Running:\n>>> "+ " ".join(cmd) )+ """ Executes the given subprocess command."""++ verbose_print(verbose, "\nMoviePy Running:\n>>> "+ " ".join(cmd))proc = sp.Popen(cmd, stderr = sp.PIPE)@@ -28,13 +30,10 @@ def subprocess_call(cmd, verbose=True, errorprint=True):proc.stderr.close()if proc.returncode:- if errorprint:- sys_write_flush( "\nMoviePy: WARNING !\n"- " The following command returned an error:\n")- sys_write_flush( err.decode('utf8'))+ verbose_print(errorprint, "\nMoviePy: This command returned an error !")raise IOError(err.decode('utf8'))else:- verboseprint( "\n... command successful.\n")+ verbose_print(verbose, "\n... command successful.\n")del proc@@ -53,3 +52,43 @@ def cvsecs(*args):return 60*args[0]+args[1]elif len(args) ==3:return 3600*args[0]+60*args[1]+args[2]+++def deprecated_version_of(f, oldname, newname=None):+ """ Indicates that a function is deprecated and has a new name.++ `f` is the new function, `oldname` the name of the deprecated+ function, `newname` the name of `f`, which can be automatically+ found.++ Returns+ ========++ f_deprecated+ A function that does the same thing as f, but with a docstring+ and a printed message on call which say that the function is+ deprecated and that you should use f instead.++ Examples+ =========++ >>> # The badly named method 'to_file' is replaced by 'write_file'+ >>> class Clip:+ >>> def write_file(self, some args):+ >>> # blablabla+ >>>+ >>> Clip.to_file = deprecated_version_of(Clip.write_file, 'to_file')+ """++ if newname is None: newname = f.__name__++ warning= ("The function ``%s`` is deprecated and is kept temporarily "+ "for backwards compatibility.\nPlease use the new name, "+ "``%s``, instead.")%(oldname, newname)++ def fdepr(*a, **kw):+ warnings.warn("MoviePy: " + warning, PendingDeprecationWarning)+ return f(*a, **kw)+ fdepr.__doc__ = warning++ return fdepr\ No newline at end of filediff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.pyindex 5140c85d..8d8d67d7 100644--- a/moviepy/video/VideoClip.py+++ b/moviepy/video/VideoClip.py@@ -10,6 +10,7 @@ import subprocessimport multiprocessingimport tempfilefrom copy import copy+from tqdm import tqdm@@ -19,7 +20,8 @@ from moviepy.decorators import (apply_to_mask,requires_duration,outplace,add_mask_if_none)-from moviepy.tools import subprocess_call, sys_write_flush+from moviepy.tools import (subprocess_call, verbose_print,+ deprecated_version_of)import moviepy.audio.io as aiofrom .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video@@ -122,7 +124,7 @@ class VideoClip(Clip):- def to_videofile(self, filename, fps=24, codec='libx264',+ def write_videofile(self, filename, fps=24, codec='libx264',bitrate=None, audio=True, audio_fps=44100,audio_nbytes = 4, audio_codec= 'libmp3lame',audio_bitrate = None, audio_bufsize = 2000,@@ -147,6 +149,8 @@ class VideoClip(Clip):by ffmpeg, but the extension of the output filename must beset accordingly.+ Some examples of codecs are:+``'libx264'`` (default codec, use file extension ``.mp4``)makes well-compressed videos (quality tunable using 'bitrate').@@ -177,7 +181,7 @@ class VideoClip(Clip):will be incorporated as a soundtrack in the movie.audiofps- frame rate to use when writing the sound.+ frame rate to use when generating the sound.temp_audiofilethe name of the temporary audiofile to be generated and@@ -208,9 +212,6 @@ class VideoClip(Clip):elif audio_codec == 'raw32':audio_codec = 'pcm_s32le'- def verbose_print(s):- if verbose: sys_write_flush(s)-if isinstance(audio, str):# audio is some audiofile it is maybe not a wav file. It is# NOT temporary file, it will NOT be removed at the end.@@ -245,7 +246,7 @@ class VideoClip(Clip):'%s unkown !'%filename)temp_audiofile = (name+Clip._TEMP_FILES_PREFIX +- "to_videofile_SOUND.%s"%audio_ext)+ "write_videofile_SOUND.%s"%audio_ext)make_audio = ( (not os.path.exists(temp_audiofile))or rewrite_audio)@@ -260,7 +261,7 @@ class VideoClip(Clip):# make a name for the temporary video filevideofile = (name + Clip._TEMP_FILES_PREFIX +- "to_videofile%s"%ext)+ "write_videofile%s"%ext)else:@@ -269,15 +270,15 @@ class VideoClip(Clip):# enough cpu for multiprocessing ?enough_cpu = (multiprocessing.cpu_count() > 2)- verbose_print("\nMoviePy: building video file %s\n"%filename- +40*"-"+"\n")+ verbose_print(verbose, "\nMoviePy: building video file %s\n"%filename+ +40*"-"+"\n")if para and make_audio and enough_cpu:# Parallelize- verbose_print("Writing audio/video in parrallel.\n")+ verbose_print(verbose, "Writing audio/video in parrallel.\n")audioproc = multiprocessing.Process(- target=self.audio.to_audiofile,+ target=self.audio.write_audiofile,args=(temp_audiofile,audio_fps,audio_nbytes,audio_bufsize,audio_codec,audio_bitrate,@@ -298,9 +299,10 @@ class VideoClip(Clip):# Don't parallelizeif make_audio:- self.audio.to_audiofile(temp_audiofile,audio_fps,+ self.audio.write_audiofile(temp_audiofile,audio_fps,audio_nbytes, audio_bufsize,- audio_codec, bitrate=audio_bitrate, write_logfile=write_logfile,+ audio_codec, bitrate=audio_bitrate,+ write_logfile=write_logfile,verbose=verbose)ffmpeg_write_video(self,@@ -312,7 +314,7 @@ class VideoClip(Clip):# Merge with audio if any and trash temporary files.if merge_audio:- verbose_print("\n\nNow merging video and audio:\n")+ verbose_print(verbose, "\n\nNow merging video and audio:\n")ffmpeg_merge_video_audio(videofile,temp_audiofile,filename, ffmpeg_output=True)@@ -320,11 +322,10 @@ class VideoClip(Clip):os.remove(videofile)if not isinstance(audio,str):os.remove(temp_audiofile)- verbose_print("\nYour video is ready ! Fingers crossed"- " for the Oscars !\n")+ verbose_print(verbose, "\nYour video is ready !\n")- def to_images_sequence(self, nameformat, fps=None, verbose=True):+ def write_images_sequence(self, nameformat, fps=None, verbose=True):""" Writes the videoclip to a sequence of image files.@@ -360,8 +361,7 @@ class VideoClip(Clip):"""- if verbose:- print( "MoviePy: Writing frames %s."%(nameformat))+ verbose_print(verbose, "MoviePy: Writing frames %s."%(nameformat))if fps is None:fps = self.fps@@ -375,14 +375,13 @@ class VideoClip(Clip):filenames.append(name)self.save_frame(name, t, savemask=True)- if verbose:- print( "MoviePy: Done writing frames %s."%(nameformat))+ verbose_print(verbose, "MoviePy: Done writing frames %s."%(nameformat))return filenames- def to_gif(self, filename, fps=None, program= 'ImageMagick',+ def write_gif(self, filename, fps=None, program= 'ImageMagick',opt="OptimizeTransparency", fuzz=1, verbose=True,loop=0, dispose=False):""" Write the VideoClip to a GIF file.@@ -424,13 +423,10 @@ class VideoClip(Clip):slower than the clip you will use ::>>> # slow down clip 50% and make it a gif- >>> myClip.speedx(0.5).to_gif('myClip.gif')+ >>> myClip.speedx(0.5).write_gif('myClip.gif')"""- def verbose_print(s):- if verbose: sys_write_flush(s)-if fps is None:fps = self.fps@@ -438,10 +434,10 @@ class VideoClip(Clip):tt = np.arange(0,self.duration, 1.0/fps)tempfiles = []- verbose_print("\nMoviePy: building GIF file %s\n"%filename- +40*"-"+"\n")+ verbose_print(verbose, "\nMoviePy: building GIF file %s\n"%filename+ +40*"-"+"\n")- verbose_print("Generating GIF frames.\n")+ verbose_print(verbose, "Generating GIF frames.\n")total = int(self.duration/fps)+1for i, t in tqdm(enumerate(tt), total=total):@@ -450,7 +446,7 @@ class VideoClip(Clip):tempfiles.append(name)self.save_frame(name, t, savemask=True)- verbose_print("Done generating GIF frames.\n")+ verbose_print(verbose, "Done generating GIF frames.\n")delay = int(100.0/fps)@@ -951,6 +947,19 @@ class ImageClip(VideoClip):setattr(self, attr, new_a)+###+#+# The old functions to_videofile, to_gif, to_images sequences have been+# replaced by the more explicite write_videofile, write_gif, etc.++VideoClip.to_videofile = deprecated_version_of(VideoClip.write_videofile,+ 'to_videofile')+VideoClip.to_gif = deprecated_version_of(VideoClip.write_videofile, 'to_gif')+VideoClip.to_images_sequence = deprecated_version_of(VideoClip.write_videofile,+ 'to_images_sequence')++###+class ColorClip(ImageClip):""" An ImageClip showing just one color.@@ -1112,10 +1121,9 @@ class TextClip(ImageClip):@staticmethoddef list(arg):- """- Returns the list of all valid entries for the argument given- (can be ``font``, ``color``, etc...) argument of ``TextClip``- """+ """ Returns the list of all valid entries for the argument of+ ``TextClip`` given (can be ``font``, ``color``, etc...) """+process = subprocess.Popen([IMAGEMAGICK_BINARY, '-list', arg],stdout=subprocess.PIPE)result = process.communicate()[0]diff --git a/moviepy/video/io/ffmpeg_writer.py b/moviepy/video/io/ffmpeg_writer.pyindex 18aec9fc..e536d3d8 100644--- a/moviepy/video/io/ffmpeg_writer.py+++ b/moviepy/video/io/ffmpeg_writer.py@@ -3,7 +3,6 @@ On the long term this will implement several methods to make videosout of VideoClips"""-import sysimport numpy as npimport subprocess as sp@@ -18,7 +17,7 @@ except ImportError:from tqdm import tqdmfrom moviepy.conf import FFMPEG_BINARY-from moviepy.tools import sys_write_flush+from moviepy.tools import verbose_print@@ -121,8 +120,8 @@ class FFMPEG_VideoWriter:"failed because FFMPEG didn't find the specified ""codec for video encoding (%s). Please install ""this codec or change the codec when calling "- "to_videofile. For instance:\n"- " >>> to_videofile('myvid.webm', codec='libvpx')")%(self.codec)+ "write_videofile. For instance:\n"+ " >>> clip.write_videofile('myvid.webm', codec='libvpx')")%(self.codec)elif "incorrect codec parameters ?" in ffmpeg_error:@@ -130,7 +129,7 @@ class FFMPEG_VideoWriter:"failed, possibly because the codec specified for ""the video (%s) is not compatible with the given ""extension (%s). Please specify a valid 'codec' "- "argument in to_videofile. This would be 'libx264' "+ "argument in write_videofile. This would be 'libx264' ""or 'mpeg4' for mp4, 'libtheora' for ogv, 'libvpx' ""for webm.")%(self.codec, self.ext)@@ -153,16 +152,13 @@ class FFMPEG_VideoWriter:def ffmpeg_write_video(clip, filename, fps, codec="libx264", bitrate=None,withmask=False, write_logfile=False, verbose=True):- def verbose_print(s):- if verbose: sys_write_flush(s)-if write_logfile:logfile = open(filename + ".log", 'w+')else:logfile = None- verbose_print("\nWriting video into %s\n"%filename)+ verbose_print(verbose, "\nWriting video into %s\n"%filename)writer = FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,bitrate=bitrate, logfile=logfile)@@ -181,7 +177,7 @@ def ffmpeg_write_video(clip, filename, fps, codec="libx264", bitrate=None,if write_logfile:logfile.close()- verbose_print("Done writing video in %s !"%filename)+ verbose_print(verbose, "Done writing video in %s !"%filename)def ffmpeg_write_image(filename, image, logfile=False):