Skip to content

Video editing with Python

Update doc code examples

osaajanib6d4c317c06d
diff --git a/docs/_static/code/getting_started/quick_presentation/basic_example.py b/docs/_static/code/getting_started/quick_presentation/basic_example.py
index aecafef8..a85473c1 100644
--- a/docs/_static/code/getting_started/quick_presentation/basic_example.py
+++ b/docs/_static/code/getting_started/quick_presentation/basic_example.py
@@ -1,20 +1,23 @@
# Import everything needed to edit video clips
from moviepy import *
-# Load example.mp4 and extract only the subclip from 00:00:50 to 00:00:60
-clip = VideoFileClip("example.mp4").subclip(50, 60)
+# Load file example.mp4 and extract only the subclip from 00:00:10 to 00:00:20
+clip = VideoFileClip("long_examples/example.mp4").with_subclip(10, 20)
# Reduce the audio volume to 80% of his original volume
-clip = clip.multiply_volume(0.8)
+clip = clip.with_multiply_volume(0.8)
# Generate a text clip. You can customize the font, color, etc.
-txt_clip = TextClip("My Holidays 2013", fontsize=70, color='white')
+txt_clip = TextClip(font="example.ttf", text="My Holidays 2013", font_size=70, color='white')
# Say that you want it to appear for 10s at the center of the screen
txt_clip = txt_clip.with_position('center').with_duration(10)
+print(clip.mask)
+print(txt_clip.mask)
+
# Overlay the text clip on the first video clip
video = CompositeVideoClip([clip, txt_clip])
# Write the result to a file (many options available!)
-video.write_videofile("result.webm")
+video.write_videofile("result.mp4")
diff --git a/docs/_static/code/user_guide/compositing/CompositeAudioClip.py b/docs/_static/code/user_guide/compositing/CompositeAudioClip.py
index 67e293d2..8dff9ff7 100644
--- a/docs/_static/code/user_guide/compositing/CompositeAudioClip.py
+++ b/docs/_static/code/user_guide/compositing/CompositeAudioClip.py
@@ -2,13 +2,13 @@ from moviepy import *
# We load all the clips we want to compose
aclip1 = AudioFileClip("example.wav")
-aclip2 = VideoFileClip("example2.wav")
-aclip3 = VideoFileClip("example3.wav")
+aclip2 = AudioFileClip("example2.wav")
+aclip3 = AudioFileClip("example3.wav")
# All clip will play one after the other
concat = concatenate_audioclips([aclip1, aclip2, aclip3])
# We will play aclip1, then ontop of it aclip2 after 5s, and the aclip3 on top of both after 9s
-compo = CompositeAudioClip([aclip1.multiply_volume(1.2),
+compo = CompositeAudioClip([aclip1.with_multiply_volume(1.2),
aclip2.with_start(5), # start at t=5s
aclip3.with_start(9)])
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/compositing/CompositeVideoClip.py b/docs/_static/code/user_guide/compositing/CompositeVideoClip.py
index 195038e7..cca966e6 100644
--- a/docs/_static/code/user_guide/compositing/CompositeVideoClip.py
+++ b/docs/_static/code/user_guide/compositing/CompositeVideoClip.py
@@ -1,7 +1,7 @@
from moviepy import *
# We load all the clips we want to compose
clip1 = VideoFileClip("example.mp4")
-clip2 = VideoFileClip("example2.mp4").with_subclip(50,60)
+clip2 = VideoFileClip("example2.mp4").with_subclip(0,1)
clip3 = VideoFileClip("example3.mp4")
# We concatenate them and write theme stacked on top of each other, with clip3 over clip2 over clip1
diff --git a/docs/_static/code/user_guide/compositing/concatenate.py b/docs/_static/code/user_guide/compositing/concatenate.py
index 69d24102..e2b2966f 100644
--- a/docs/_static/code/user_guide/compositing/concatenate.py
+++ b/docs/_static/code/user_guide/compositing/concatenate.py
@@ -2,7 +2,7 @@ from moviepy import VideoFileClip, concatenate_videoclips
# We load all the clips we want to concatenate
clip1 = VideoFileClip("example.mp4")
-clip2 = VideoFileClip("example2.mp4").with_subclip(50,60)
+clip2 = VideoFileClip("example2.mp4").with_subclip(0,1)
clip3 = VideoFileClip("example3.mp4")
# We concatenate them and write the result
diff --git a/docs/_static/code/user_guide/compositing/crossfadein.py b/docs/_static/code/user_guide/compositing/crossfadein.py
index 3c02f948..63060de4 100644
--- a/docs/_static/code/user_guide/compositing/crossfadein.py
+++ b/docs/_static/code/user_guide/compositing/crossfadein.py
@@ -2,15 +2,15 @@ from moviepy import *
# We load all the clips we want to compose
clip1 = VideoFileClip("example.mp4")
-clip2 = VideoFileClip("exampl2.mp4").with_subclip(50,60)
+clip2 = VideoFileClip("example2.mp4").with_subclip(0,1)
# Clip2 will be on top of clip1 for 1s
-clip1 = clip1.with_end(6)
-clip2 = clip2.with_start(5)
+clip1 = clip1.with_end(2)
+clip2 = clip2.with_start(1)
# We will add a crossfadein on clip2 for 1s
# As the other effects, transitions are added to Clip methods at runtime
-clip2 = clip2.crossfadein(1)
+clip2 = clip2.with_effects([vfx.CrossFadeIn(1)])
diff --git a/docs/_static/code/user_guide/compositing/juxtaposing.py b/docs/_static/code/user_guide/compositing/juxtaposing.py
index 10cdf2ff..e81f471a 100644
--- a/docs/_static/code/user_guide/compositing/juxtaposing.py
+++ b/docs/_static/code/user_guide/compositing/juxtaposing.py
@@ -1,14 +1,14 @@
from moviepy import VideoFileClip, clips_array, vfx
# We will use the same clip and transform it in 3 ways
-clip1 = VideoFileClip("example.mp4").fx(vfx.margin, 10) # add 10px contour
-clip2 = clip1.fx(vfx.mirror_x) # Flip horizontaly
-clip3 = clip1.fx(vfx.mirror_y) # Flip verticaly
-clip4 = clip1.resize(0.60) # downsize to 60% of original
+clip1 = VideoFileClip("example.mp4").with_effects([vfx.Margin(10)]) # add 10px contour
+clip2 = clip1.with_effects([vfx.MirrorX()]) # Flip horizontaly
+clip3 = clip1.with_effects([vfx.MirrorY()]) # Flip verticaly
+clip4 = clip1.resized(0.60) # downsize to 60% of original
# The form of the final clip will depend of the shape of the array
# We want our clip to be our 4 videos, 2x2, so we make an array of 2x2
final_clip = clips_array([[clip1, clip2], [clip3, clip4]])
-final_clip = final_clip.resize(width=480) # We resize the resulting clip to have the dimensions we want
+final_clip = final_clip.resized(width=480) # We resize the resulting clip to have the dimensions we want
final_clip.write_videofile("final_clip.mp4")
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/compositing/with_position.py b/docs/_static/code/user_guide/compositing/with_position.py
index 71185db1..3dc21c20 100644
--- a/docs/_static/code/user_guide/compositing/with_position.py
+++ b/docs/_static/code/user_guide/compositing/with_position.py
@@ -1,11 +1,11 @@
from moviepy import *
# We load all the clips we want to compose
-background = VideoFileClip("example2.mp4").with_subclip(0, 10)
-title = TextClip("./example.ttf", text="Big Buck Bunny", font_size=80, color="#fff", text_align="center", duration=3)
-author = TextClip("./example.ttf", text="Blender Foundation", font_size=40, color="#fff", text_align="center", duration=3)
-copyright = TextClip("./example.ttf", text="© CC BY 3.0", font_size=20, color="#fff", text_align="center", duration=3)
-logo = ImageClip("./example2.png", duration=3).resize(height=50)
+background = VideoFileClip("example2.mp4").with_subclip(0, 2)
+title = TextClip("./example.ttf", text="Big Buck Bunny", font_size=80, color="#fff", text_align="center", duration=1)
+author = TextClip("./example.ttf", text="Blender Foundation", font_size=40, color="#fff", text_align="center", duration=1)
+copyright = TextClip("./example.ttf", text="© CC BY 3.0", font_size=20, color="#fff", text_align="center", duration=1)
+logo = ImageClip("./example2.png", duration=1).resized(height=50)
# We want our title to be at the center horizontaly and start at 25% of the video verticaly
# We can set as "center", "left", "right", "top" and "bottom", and % relative from the clip size
diff --git a/docs/_static/code/user_guide/compositing/with_start.py b/docs/_static/code/user_guide/compositing/with_start.py
index 525fad17..affebd2a 100644
--- a/docs/_static/code/user_guide/compositing/with_start.py
+++ b/docs/_static/code/user_guide/compositing/with_start.py
@@ -2,17 +2,17 @@ from moviepy import *
# We load all the clips we want to compose
clip1 = VideoFileClip("example.mp4")
-clip2 = VideoFileClip("example2.mp4").with_subclip(50,60)
+clip2 = VideoFileClip("example2.mp4").with_subclip(0,1)
clip3 = VideoFileClip("example3.mp4")
-# We want to stop clip1 after 6s
-clip1 = clip1.with_end(6)
+# We want to stop clip1 after 1s
+clip1 = clip1.with_end(1)
-# We want to play clip2 after 5s
-clip2 = clip2.with_start(5)
+# We want to play clip2 after 1.5s
+clip2 = clip2.with_start(1.5)
# We want to play clip3 at the end of clip2, and so for 3 seconds only
-clip3 = clip3.with_start(clip2.end).with_duration(3) # Some times its more practical to modify the duration of a clip instead of his end
+clip3 = clip3.with_start(clip2.end).with_duration(1) # Some times its more practical to modify the duration of a clip instead of his end
# We write the result
final_clip = CompositeVideoClip([clip1,clip2,clip3])
diff --git a/docs/_static/code/user_guide/effects/image_transform.py b/docs/_static/code/user_guide/effects/image_transform.py
index d0427d84..f51b6939 100644
--- a/docs/_static/code/user_guide/effects/image_transform.py
+++ b/docs/_static/code/user_guide/effects/image_transform.py
@@ -7,4 +7,4 @@ def invert_green_blue(image: numpy.ndarray) -> numpy.ndarray :
return image[:,:,[0,2,1]]
-modified_clip1 = my_clip.time_transform(invert_green_blue)
\ No newline at end of file
+modified_clip1 = my_clip.image_transform(invert_green_blue)
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/effects/modify_copy_example.py b/docs/_static/code/user_guide/effects/modify_copy_example.py
index 68e00b4b..4918c8e6 100644
--- a/docs/_static/code/user_guide/effects/modify_copy_example.py
+++ b/docs/_static/code/user_guide/effects/modify_copy_example.py
@@ -6,15 +6,15 @@ clip = VideoFileClip("example.mp4")
# This does nothing, as multiply_volume will return a copy of clip which you will loose immediatly as you dont store it
# If you was to render clip now, the audio would still be at full volume
-clip.multiply_volume(0.1)
+clip.with_multiply_volume(0.1)
# This create a copy of clip in clip_whisper with a volume of only 10% the original, but does not modify the original clip
# If you was to render clip right now, the audio would still be at full volume
# If you was to render clip_whisper, the audio would be a 10% of the original volume
-clip_whisper = clip.multiply_volume(0.1)
+clip_whisper = clip.with_multiply_volume(0.1)
# This replace the original clip with a copy of it where volume is only 10% of the original
# If you was to render clip now, the audio would be at 10%
# The original clip is now lost
-clip = clip.multiply_volume(0.1)
+clip = clip.with_multiply_volume(0.1)
diff --git a/docs/_static/code/user_guide/effects/using_effects.py b/docs/_static/code/user_guide/effects/using_effects.py
new file mode 100644
index 00000000..7588991a
--- /dev/null
+++ b/docs/_static/code/user_guide/effects/using_effects.py
@@ -0,0 +1,11 @@
+from moviepy import VideoFileClip
+from moviepy import vfx, afx
+
+myclip = VideoFileClip("example.mp4")
+myclip = myclip.with_effects([vfx.Resize(width=460)]) # resize clip to be 460px in width, keeping aspect ratio
+
+# fx method return a copy of the clip, so we can easily chain them
+myclip = myclip.with_effects([vfx.MultiplySpeed(2), afx.MultiplyVolume(0.5)]) # double the speed and half the audio volume
+
+# because effects are added to Clip at runtime, you can also call them directly from your clip as methods
+myclip = myclip.with_effects([vfx.MultiplyColor(0.5)]) # darken the clip
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/effects/using_effects_fx.py b/docs/_static/code/user_guide/effects/using_effects_fx.py
deleted file mode 100644
index 1fba61f5..00000000
--- a/docs/_static/code/user_guide/effects/using_effects_fx.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from moviepy import VideoFileClip
-from moviepy import vfx, afx
-
-myclip = VideoFileClip("example.mp4")
-myclip = myclip.fx(vfx.resize, width=460) # resize clip to be 460px in width, keeping aspect ratio
-
-# fx method return a copy of the clip, so we can easily chain them
-myclip = myclip.fx(vfx.multiply_speed, 2).fx(afx.multiply_volume, 0.5) # double the speed and half the audio volume
-
-# because effects are added to Clip at runtime, you can also call them directly from your clip as methods
-myclip = myclip.multiply_color(0.5) #dDarken the clip
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/effects/using_with_methods.py b/docs/_static/code/user_guide/effects/using_with_methods.py
index 422fb5ff..3ad601fa 100644
--- a/docs/_static/code/user_guide/effects/using_with_methods.py
+++ b/docs/_static/code/user_guide/effects/using_with_methods.py
@@ -1,6 +1,17 @@
from moviepy import VideoFileClip
from moviepy import vfx, afx
+# from os import listdir
+# from os.path import isfile, join
+
+# import os
+# dir = os.path.dirname(__file__)
+# onlyfiles = [f for f in listdir(dir) if isfile(join(dir, f))]
+
+# import pathlib
+# print(globals())
+# print(pathlib.Path('./').resolve())
+# print(onlyfiles)
myclip = VideoFileClip("example.mp4")
myclip = myclip.with_end(5) # stop the clip after 5 sec
myclip = myclip.without_audio() # remove the audio of the clip
diff --git a/docs/_static/code/user_guide/loading/AudioFileClip.py b/docs/_static/code/user_guide/loading/AudioFileClip.py
index 96e824c0..89f2c8ac 100644
--- a/docs/_static/code/user_guide/loading/AudioFileClip.py
+++ b/docs/_static/code/user_guide/loading/AudioFileClip.py
@@ -2,5 +2,5 @@ from moviepy import *
import numpy as np
# Works for audio files, but also videos file where you only want the keep the audio track
-clip = AudioFileClip("example.mp3")
-clip.write_audiofile('./result.mp3')
+clip = AudioFileClip("example.wav")
+clip.write_audiofile('./result.wav')
diff --git a/docs/_static/code/user_guide/loading/ImageClip.py b/docs/_static/code/user_guide/loading/ImageClip.py
index 5bdea2c5..1d3373a6 100644
--- a/docs/_static/code/user_guide/loading/ImageClip.py
+++ b/docs/_static/code/user_guide/loading/ImageClip.py
@@ -6,4 +6,4 @@ noise_image = np.random.randint(low=0, high=255, size=(100, 200, 3))
myclip1 = ImageClip("example.png") # You can create it from a path
myclip2 = ImageClip(noise_image) # from a (height x width x 3) RGB numpy array
-myclip3 = VideoFileClip("./result.mp4").to_ImageClip(t='00:00:05') # Or load videoclip and extract frame at a given time
+myclip3 = VideoFileClip("./example.mp4").to_ImageClip(t='00:00:01') # Or load videoclip and extract frame at a given time
diff --git a/docs/_static/code/user_guide/loading/ImageSequenceClip.py b/docs/_static/code/user_guide/loading/ImageSequenceClip.py
index 05de0b66..a394c8d8 100644
--- a/docs/_static/code/user_guide/loading/ImageSequenceClip.py
+++ b/docs/_static/code/user_guide/loading/ImageSequenceClip.py
@@ -1,14 +1,14 @@
from moviepy import *
# A clip with a list of images showed for 1 second each
-myclip = ImageSequenceClip(["example.png", "example2.png", "example3.png"], durations=1)
+myclip = ImageSequenceClip(['example_img_dir/image_0001.jpg', 'example_img_dir/image_0002.jpg', 'example_img_dir/image_0003.jpg'], durations=[1, 1, 1])
print('Clip duration: {}'.format(myclip.duration)) # 3 images, 1 seconds each, duration = 3
print('Clip fps: {}'.format(myclip.fps)) # 3 seconds, 3 images, fps is 3/3 = 1
# This time we will load all images in the dir, and instead of showing theme for X seconds, we will define FPS
myclip2 = ImageSequenceClip("./example_img_dir", fps=30)
-print('Clip duration: {}'.format(myclip.duration)) # fps = 30, so duration = nb images in dir / 30
-print('Clip fps: {}'.format(myclip.fps)) # fps = 30
+print('Clip duration: {}'.format(myclip2.duration)) # fps = 30, so duration = nb images in dir / 30
+print('Clip fps: {}'.format(myclip2.fps)) # fps = 30
myclip.write_gif("result.gif") # the gif will be 3 sec and 1 fps
myclip2.write_gif("result2.gif") # the gif will be 30 fps, duration will vary based on number of images in dir
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/loading/TextClip.py b/docs/_static/code/user_guide/loading/TextClip.py
index a9ddca4d..6f0b0517 100644
--- a/docs/_static/code/user_guide/loading/TextClip.py
+++ b/docs/_static/code/user_guide/loading/TextClip.py
@@ -4,14 +4,14 @@ font="./example.ttf"
# First we use as string and let system autocalculate clip dimensions to fit the text
# we set clip duration to 2 secs, if we do not, it got an infinite duration
-txt_clip1 = TextClip(font=font, text="Hello World !", font_size=30, color="#FF0000", bg_color="#FFFFFF", duration=3) # Red
+txt_clip1 = TextClip(font=font, text="Hello World !", font_size=30, color="#FF0000", bg_color="#FFFFFF", duration=2) # Red
# This time we load text from a file, we set a fixed size for clip and let the system find best font size,
# allowing for line breaking
txt_clip2 = TextClip(font=font, filename="./example.txt", size=(500, 200), bg_color="#FFFFFF", method="caption", color=(0, 0, 255, 127)) # Blue with 50% transparency
# we set duration, because by default image clip are infinite, and we cannot render infinite
-txt_clip2 = txt_clip2.with_duration(3)
+txt_clip2 = txt_clip2.with_duration(2)
txt_clip1.write_videofile("result1.mp4", fps=24) # ImageClip have no FPS either, so we must defined it
txt_clip2.write_videofile("result2.mp4", fps=24)
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/loading/VideoFileClip.py b/docs/_static/code/user_guide/loading/VideoFileClip.py
index d6f2641e..2b63a69c 100644
--- a/docs/_static/code/user_guide/loading/VideoFileClip.py
+++ b/docs/_static/code/user_guide/loading/VideoFileClip.py
@@ -6,8 +6,8 @@ myclip = VideoFileClip("example.mp4")
print('Clip duration: {}'.format(myclip.duration))
print('Clip fps: {}'.format(myclip.fps))
-myclip = myclip.with_subclip(5, 10) # Cutting the clip between 5 and 10 secs.
+myclip = myclip.with_subclip(0.5, 2) # Cutting the clip between 0.5 and 2 secs.
print('Clip duration: {}'.format(myclip.duration)) # Cuting will update duration
print('Clip fps: {}'.format(myclip.fps)) # and keep fps
-myclip.write_videofile("result.mp4") # the output video will be 5 sec long and use original fps
\ No newline at end of file
+myclip.write_videofile("result.mp4") # the output video will be 1.5 sec long and use original fps
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/loading/closing.py b/docs/_static/code/user_guide/loading/closing.py
index 1414d6b7..352e15e1 100644
--- a/docs/_static/code/user_guide/loading/closing.py
+++ b/docs/_static/code/user_guide/loading/closing.py
@@ -1,6 +1,8 @@
from moviepy import *
-with AudioFileClip("example.mp3") as clip:
- raise Exception("Let's simulate an exception")
-
+try:
+ with AudioFileClip("example.wav") as clip:
+ raise Exception("Let's simulate an exception")
+except Exception as e:
+ print('{}'.format(e))
# clip.close() is implicitly called, so the lock on my_audiofile.mp3 file is immediately released.
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/loading/loading.py b/docs/_static/code/user_guide/loading/loading.py
index cb684c67..b32c3e0b 100644
--- a/docs/_static/code/user_guide/loading/loading.py
+++ b/docs/_static/code/user_guide/loading/loading.py
@@ -13,9 +13,9 @@ make_frame_audio = lambda t: np.sin(440 * 2 * np.pi * t)
# VIDEO CLIPS`
clip = VideoClip(make_frame, duration=5) # for custom animations, where make_frame is a function returning an image as numpy array for a given time
clip = VideoFileClip("example.mp4") # for videos
-clip = ImageSequenceClip(['example.png', 'example2.png', 'example3.png'], fps=24) # for a list or directory of images to be used as a video sequence
+clip = ImageSequenceClip('example_img_dir', fps=24) # for a list or directory of images to be used as a video sequence
clip = ImageClip("example.png") # For a picture
-clip = TextClip("Hello!", font="./example.ttf", fontsize=70, color="black") # To create the image of a text
+clip = TextClip(font="./example.ttf", text="Hello!", font_size=70, color="black") # To create the image of a text
clip = ColorClip(size=(460,380), color=black) # a clip of a single unified color, where color is a RGB tuple/array/list
# AUDIO CLIPS
diff --git a/docs/_static/code/user_guide/loading/masks.py b/docs/_static/code/user_guide/loading/masks.py
index dc0f6f75..6caa1009 100644
--- a/docs/_static/code/user_guide/loading/masks.py
+++ b/docs/_static/code/user_guide/loading/masks.py
@@ -6,7 +6,7 @@ makeframe = lambda t : np.random.rand(100, 200)
# To define the VideoClip as a mask, just pass parameter is_mask as True
maskclip1 = VideoClip(makeframe, duration=4, is_mask=True) # A random noise mask
-maskclip2 = ImageClip("example_mask.jpeg", is_mask=True) # A fixed mask as jpeg
+maskclip2 = ImageClip("example_mask.jpg", is_mask=True) # A fixed mask as jpeg
maskclip3 = VideoFileClip("example_mask.mp4", is_mask=True) # A video as a mask
# Load our basic clip, resize to 200x100 and apply each mask
diff --git a/docs/_static/code/user_guide/rendering/display_in_notebook.py b/docs/_static/code/user_guide/rendering/display_in_notebook.py
index c2cce3cc..580183ea 100644
--- a/docs/_static/code/user_guide/rendering/display_in_notebook.py
+++ b/docs/_static/code/user_guide/rendering/display_in_notebook.py
@@ -6,7 +6,7 @@ from moviepy import *
my_video_clip = VideoFileClip('./example.mp4')
my_image_clip = ImageClip('./example.png')
-my_audio_clip = AudioClip('./example.mp3')
+my_audio_clip = AudioFileClip('./example.wav')
# We can show any type of clip
my_video_clip.display_in_notebook() # embeds a video
diff --git a/docs/_static/code/user_guide/rendering/preview.py b/docs/_static/code/user_guide/rendering/preview.py
index f2a3f096..02da0e2c 100644
--- a/docs/_static/code/user_guide/rendering/preview.py
+++ b/docs/_static/code/user_guide/rendering/preview.py
@@ -1,13 +1,13 @@
from moviepy import *
-myclip = VideoFileClip('./example.mp4')
+myclip = VideoFileClip('./example.mp4').with_subclip(0, 1) # Keep only 0 to 1 sec
# We preview our clip as a video, inheriting FPS and audio of the original clip
myclip.preview()
# We preview our clip as video, but with a custom FPS for video and audio
# making it less consuming for our computer
-myclip.preview(fps=10, audio_fps=11000)
+myclip.preview(fps=5, audio_fps=11000)
-# Now we preview our clip to show only portion from 00:00:30 to 00:00:35
-myclip.with_subclip(30, 35).preview(fps=10, audio=False)
+# Now we preview without audio
+myclip.preview(audio=False)
diff --git a/docs/_static/code/user_guide/rendering/show.py b/docs/_static/code/user_guide/rendering/show.py
index 6416c273..1fade8a0 100644
--- a/docs/_static/code/user_guide/rendering/show.py
+++ b/docs/_static/code/user_guide/rendering/show.py
@@ -9,4 +9,4 @@ myclip.show()
myclip.show(30)
# We want to see our clip without applying his mask
-myclip.preview(30, with_mask=False)
+myclip.show(30, with_mask=False)
diff --git a/docs/_static/code/user_guide/rendering/write_images_sequence.py b/docs/_static/code/user_guide/rendering/write_images_sequence.py
index 2dbe8096..c0cc5b1f 100644
--- a/docs/_static/code/user_guide/rendering/write_images_sequence.py
+++ b/docs/_static/code/user_guide/rendering/write_images_sequence.py
@@ -1,8 +1,10 @@
from moviepy import *
+import os
myclip = VideoFileClip("example.mp4")
# Here we just save in dir output with filename being his index (start at 0, then +1 for each frame)
+os.mkdir('./output')
myclip.write_images_sequence("./output/%d.jpg")
# We set the FPS of our GIF at 10, and we leftpad name with 0 up to 4 digits
diff --git a/docs/_static/code/user_guide/rendering/write_videofile.py b/docs/_static/code/user_guide/rendering/write_videofile.py
index 54659576..b63fbe52 100644
--- a/docs/_static/code/user_guide/rendering/write_videofile.py
+++ b/docs/_static/code/user_guide/rendering/write_videofile.py
@@ -20,4 +20,4 @@ final_clip.write_videofile("result24fps.mp4", fps=24)
# the video quality and it will decrease time for encoding, but increase final file size a lot.
# Finally, we want ffmpeg to use 4 threads for video encoding. You should probably leave that
# to default, as ffmpeg is already quite good at using the best setting on his own.
-final_clip.write_videofile("result.webm", codec="libvpx", fps=24, preset="ultrafast", threads=4)
\ No newline at end of file
+final_clip.write_videofile("result.webm", codec="libvpx-vp9", fps=24, preset="ultrafast", threads=4)
\ No newline at end of file
diff --git a/docs/_static/code/user_guide/rendering/write_videofile_duration.py b/docs/_static/code/user_guide/rendering/write_videofile_duration.py
index 031a4f9f..76302d8a 100644
--- a/docs/_static/code/user_guide/rendering/write_videofile_duration.py
+++ b/docs/_static/code/user_guide/rendering/write_videofile_duration.py
@@ -9,5 +9,5 @@ try :
except :
print('Cannot write a video without duration')
-# By calling with_duration on our clip, we fix the problem!
-my_clip.with_duration(5).write_videofile("result.mp4")
\ No newline at end of file
+# By calling with_duration on our clip, we fix the problem! We also need to set fps
+my_clip.with_duration(5).write_videofile("result.mp4", fps=1)
\ No newline at end of file
diff --git a/docs/user_guide/modifying.rst b/docs/user_guide/modifying.rst
index 2eee348b..df051619 100644
--- a/docs/user_guide/modifying.rst
+++ b/docs/user_guide/modifying.rst
@@ -84,7 +84,7 @@ For convenience the effects are also dynamically added as method of :py:class:`~
So, you may write something like :
-.. literalinclude:: /_static/code/user_guide/effects/using_effects_fx.py
+.. literalinclude:: /_static/code/user_guide/effects/using_effects.py
:language: python
.. note::