Skip to content

Commit

Permalink
Merge pull request #462 from kerstin/fix_mixed_content
Browse files Browse the repository at this point in the history
Fix mixed content
  • Loading branch information
kerstin authored Mar 5, 2017
2 parents 1fb79c1 + 0afd246 commit fe742ad
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 72 deletions.
18 changes: 9 additions & 9 deletions docs/FAQ.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
FAQ and troubleshooting
=========================

This section will fill up as MoviePy advances through the next steps of
development (currently on the roadmap: MoviePy Studio, MoviePy WebApp, MoviePy OS, MoviePy
This section will fill up as MoviePy advances through the next steps of
development (currently on the roadmap: MoviePy Studio, MoviePy WebApp, MoviePy OS, MoviePy
Trust Inc., and the MoviePy Charity Fundation).

Common errors that are not bugs
--------------------------------

These are very common errors which are not considered as bugs to be
solved (but you can still ask for this to change). If these answers
These are very common errors which are not considered as bugs to be
solved (but you can still ask for this to change). If these answers
don't work for you, please open a bug report on Github_, or on the dedicated forum on Reddit_, or on the librelist_.

MoviePy generated a video that cannot be read by my favorite player.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


Known reason : one of the video's dimensions were not even,
for instance 720x405, and you used a MPEG4 codec like libx264 (default
in MoviePy). In this case the video generated uses a format that is
Known reason: one of the video's dimensions were not even,
for instance 720x405, and you used a MPEG4 codec like libx264 (default
in MoviePy). In this case the video generated uses a format that is
readable only on some readers like VLC.

I can't seem to read any video with MoviePy
""""""""""""""""""""""""""""""""""""""""""""""

Known reason: you have a deprecated version of FFMPEG, install a recent version from the
Known reason: you have a deprecated version of FFMPEG, install a recent version from the
website, not from your OS's repositories ! (see :ref:`installation`).

Previewing videos make them slower than they are
Expand All @@ -33,6 +33,6 @@ Previewing videos make them slower than they are
It means that your computer is not good enough to render the clip in real time. Don't hesitate to play with the options of ``preview``: for instance, lower the fps of the sound (11000 Hz is still fine) and the video. Also, downsizing your video with ``resize`` can help.

.. _Github: https://github.com/Zulko/moviepy
.. _Reddit: http://www.reddit.com/r/moviepy/
.. _Reddit: https://www.reddit.com/r/moviepy/
.. _librelist: mailto:moviepy@librelist.com

26 changes: 13 additions & 13 deletions docs/gallery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Videos edited with Moviepy
The Cup Song Covers Mix
~~~~~~~~~~~~~~~~~~~~~~~~

This mix of 60 covers of the Cup Song demonstrates the non-linear video editing capabilities of MoviePy. Here is `the (undocumented) MoviePy code <http://nbviewer.ipython.org/github/Zulko/--video-editing---Cup-Song-Covers-Mix/blob/master/CupSongsCovers.ipynb>`_ that generated the video.
This mix of 60 covers of the Cup Song demonstrates the non-linear video editing capabilities of MoviePy. Here is `the (undocumented) MoviePy code <https://nbviewer.ipython.org/github/Zulko/--video-editing---Cup-Song-Covers-Mix/blob/master/CupSongsCovers.ipynb>`_ that generated the video.

.. raw:: html

Expand Down Expand Up @@ -47,22 +47,22 @@ GIFs made from videos
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This `tutorial
<http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/>`_ gives you the basics to make gifs from video files (cutting, croping, adding text...). The last example shows how to remove a (still) background to keep only the animated part of a video.
<https://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/>`_ gives you the basics to make gifs from video files (cutting, croping, adding text...). The last example shows how to remove a (still) background to keep only the animated part of a video.


.. raw:: html

<a href="http://imgur.com/Fo2BxBK"><img src="http://i.imgur.com/Fo2BxBK.gif" title="Hosted by imgur.com"
<a href="https://imgur.com/Fo2BxBK"><img src="https://i.imgur.com/Fo2BxBK.gif" title="Hosted by imgur.com"
style="max-width:50%; height:'auto'; display:block; margin-left: auto;margin-right: auto; margin-bottom:30px;" /></a>

Vector Animations
~~~~~~~~~~~~~~~~~~~

This `tutorial <http://zulko.github.io/blog/2014/09/20/vector-animations-with-python/>`_ shows how to combine MoviePy with Gizeh to create animations:
This `tutorial <https://zulko.github.io/blog/2014/09/20/vector-animations-with-python/>`_ shows how to combine MoviePy with Gizeh to create animations:

.. raw:: html

<a href="http://imgur.com/2YdW9yf"><img src="http://i.imgur.com/2YdW9yf.gif"
<a href="https://imgur.com/2YdW9yf"><img src="https://i.imgur.com/2YdW9yf.gif"
style="max-width:50%; height:'auto'; display:block; margin-left: auto;margin-right: auto; margin-bottom:30px;" /></a>


Expand All @@ -72,11 +72,11 @@ It is also possible to combine MoviePy with other graphic librairies like matplo
3D animations
~~~~~~~~~~~~~~~~~~~

This `tutorial <http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ shows how to combine MoviePy with Vapory, a library to render 3D scenes using the free ray-tracer POV-Ray
This `tutorial <https://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ shows how to combine MoviePy with Vapory, a library to render 3D scenes using the free ray-tracer POV-Ray

.. raw:: html

<a href="http://imgur.com/2YdW9yf"><img src="http://i.imgur.com/XN7e2IP.gif"
<a href="https://imgur.com/2YdW9yf"><img src="https://i.imgur.com/XN7e2IP.gif"
style="max-width:70%; height:'auto'; display:block; margin-left: auto;margin-right: auto; margin-bottom:30px;" /></a>


Expand All @@ -96,7 +96,7 @@ Or render the result of this physics simulation made with PyODE (`script <https:

.. raw:: html

<a href="http://imgur.com/2YdW9yf"><img src="http://i.imgur.com/TdhxwGz.gif"
<a href="https://imgur.com/2YdW9yf"><img src="https://i.imgur.com/TdhxwGz.gif"
style="max-width:70%; height:'auto'; display:block; margin-left: auto;margin-right: auto; margin-bottom:30px;" /></a>


Expand All @@ -114,7 +114,7 @@ Or use `this script <https://gist.github.com/Zulko/b910c8b22e8e1c01fae6>`_ to ma
Data animations
----------------

This `tutorial <http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ shows how to use MoviePy to animate the different Python vizualization libraries: Mayavi, Vispy, Scikit-image, Matplotlib, etc.
This `tutorial <https://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/>`_ shows how to use MoviePy to animate the different Python vizualization libraries: Mayavi, Vispy, Scikit-image, Matplotlib, etc.


Scientific or technological projects
Expand All @@ -124,7 +124,7 @@ Scientific or technological projects
Piano rolls transcription to sheet music
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This `blog post <http://zulko.github.io/blog/2014/02/12/transcribing-piano-rolls/>`_ explains how to transform a video of a piano roll performance into playable sheet music. MoviePy is used for the frame-by-frame analysis of the piano roll video. The last video is also edited with MoviePy:
This `blog post <https://zulko.github.io/blog/2014/02/12/transcribing-piano-rolls/>`_ explains how to transform a video of a piano roll performance into playable sheet music. MoviePy is used for the frame-by-frame analysis of the piano roll video. The last video is also edited with MoviePy:

.. raw:: html

Expand All @@ -148,7 +148,7 @@ MoviePy is used to add transitions, titles and music to the videos.

.. raw:: html

<a href="http://imgur.com/2YdW9yf"><img src="https://pbs.twimg.com/media/B2_NlnwCMAAingW.jpg"
<a href="https://imgur.com/2YdW9yf"><img src="https://pbs.twimg.com/media/B2_NlnwCMAAingW.jpg"
style="max-width:70%; height:'auto'; display:block; margin-left: auto;margin-right: auto; margin-bottom:30px;" /></a>


Expand All @@ -170,7 +170,7 @@ Here are `Videogrep's introductory blog post

If you liked it, also have a look at these Videogrep-inspired projects:

This `blog post <http://zulko.github.io/blog/2014/06/21/some-more-videogreping-with-python/>`_ attempts to cut a video precisely at the beginning and end of sentences or words: ::
This `blog post <https://zulko.github.io/blog/2014/06/21/some-more-videogreping-with-python/>`_ attempts to cut a video precisely at the beginning and end of sentences or words: ::

words = ["Americans", "must", "develop", "open ", "source",
" software", "for the", " rest ", "of the world",
Expand All @@ -189,7 +189,7 @@ This `blog post <http://zulko.github.io/blog/2014/06/21/some-more-videogreping-w
</div>


This `other post <http://zulko.github.io/blog/2014/07/04/automatic-soccer-highlights-compilations-with-python/>`_ uses MoviePy to automatically cut together all the highlights of a soccer game, based on the fact that the crowd cheers louder when something interesting happens. All in under 30 lines of Python:
This `other post <https://zulko.github.io/blog/2014/07/04/automatic-soccer-highlights-compilations-with-python/>`_ uses MoviePy to automatically cut together all the highlights of a soccer game, based on the fact that the crowd cheers louder when something interesting happens. All in under 30 lines of Python:

.. raw:: html

Expand Down
32 changes: 16 additions & 16 deletions docs/getting_started/clips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,31 @@ Creating and exporting video clips
Video and audio clips are the central objects of MoviePy. In this section we present the different sorts of clips, how to create them, and how to write them to a file. For informations on modifying a clip (cuts, effects, etc.), see :ref:`effects`. For how to put clips together see :ref:`CompositeVideoClips` and to see how to preview clips before writing a file, refer to :ref:`efficient`.

The following code summarizes the base clips that you can create with moviepy: ::

# VIDEO CLIPS
clip = VideoClip(make_frame, duration=4) # for custom animations (see below)
clip = VideoFileClip("my_video_file.mp4") # or .avi, .webm, .gif ...
clip = ImageSequenceClip(['image_file1.jpeg', ...], fps=24)
clip = ImageClip("my_picture.png") # or .jpeg, .tiff, ...
clip = TextClip("Hello !", font="Amiri-Bold", fontsize=70, color="black")
clip = ColorClip(size=(460,380), color=[R,G,B])

# AUDIO CLIPS
clip = AudioFileClip("my_audiofile.mp3") # or .ogg, .wav... or a video !
clip = AudioArrayClip(numpy_array, fps=44100) # from a numerical array
clip = AudioClip(make_frame, duration=3) # uses a function make_frame(t)
clip = AudioClip(make_frame, duration=3) # uses a function make_frame(t)



The best to understand these clips is to read the full documentation for each in the :ref:`reference_manual`. The next sections
In this section we see how to create clips, (for instance from video or audio files), how to mix them together, and how to write them to a file.
In this section we see how to create clips, (for instance from video or audio files), how to mix them together, and how to write them to a file.



Categories of video clips
~~~~~~~~~~~~~~~~~~~~~~~~~~

Video clips are the building blocks of longer videos. Technically, they are clips with a ``clip.get_frame(t)`` method which outputs a HxWx3 numpy array representing the frame of the clip at time *t*. There are two main categories: animated clips (made with ``VideoFileClip`` and ``VideoClip``) and unanimated clips which show the same picture for an a-priori infinite duration (``ImageClip``, ``TextClip``,``ColorClip``). There are also special video clips call masks, which belong to the categories above but output greyscale frames indicating which parts of another clip are visible or not. A video clip can carry around an audio clip (``clip.audio``) which is its *soundtrack*, and a mask clip.
Video clips are the building blocks of longer videos. Technically, they are clips with a ``clip.get_frame(t)`` method which outputs a HxWx3 numpy array representing the frame of the clip at time *t*. There are two main categories: animated clips (made with ``VideoFileClip`` and ``VideoClip``) and unanimated clips which show the same picture for an a-priori infinite duration (``ImageClip``, ``TextClip``,``ColorClip``). There are also special video clips call masks, which belong to the categories above but output greyscale frames indicating which parts of another clip are visible or not. A video clip can carry around an audio clip (``clip.audio``) which is its *soundtrack*, and a mask clip.

VideoClip
""""""""""
Expand Down Expand Up @@ -61,12 +61,12 @@ VideoFileClip
"""""""""""""""

A VideoFileClip is a clip read from a video file (most formats are supported) or a GIF file. You load the video as follows: ::

myclip = VideoFileClip("some_video.avi")
myclip = VideoFileClip("some_animation.gif")

Note that these clips will have an ``fps`` (frame per second) attribute, which will be transmitted if you do small modifications of the clip, and will be used by default in ``write_videofile``, ``write_gif``, etc. For instance: ::

myclip = VideoFileClip("some_video.avi")
print (myclip.fps) # prints for instance '30'
# Now cut the clip between t=10 and 25 secs. This conserves the fps.
Expand All @@ -92,7 +92,7 @@ ImageClip
""""""""""

An ImageClip is a video clip that always displays the same image. You can create one as follows: ::

myclip = ImageClip("some_picture.jpeg")
myclip = ImageClip(somme_array) # a (height x width x 3) RGB numpy array
myclip = some_video_clip.to_ImageClip(t='01:00:00') # frame at t=1 hour.
Expand All @@ -109,16 +109,16 @@ TextClip
Generating a TextClip requires to have ImageMagick installed and (for windows users) linked to MoviePy, see the installation instructions.

Here is how you make a textclip (you won't need all these options all the time): ::

myclip = TextClip("Hello", font='Amiri-Bold')


The font can be any font installed on your computer, but ImageMagick will have specific names for it. For instance the *normal* Amiri font will be called ``Amiri-Regular`` while the Impact font will be called ``Impact-Normal``. To get a list of the possible fonts, type ``TextClip.list('fonts')``. To find all the font names related to a given font, use for instance ::

TextClip.search('Amiri', 'fonts') # Returns all font names containing Amiri

Note also that the use of a stroke (or contour) will not work well on small letters, so if you need a small text with a contour, it is better to generate a big text, then downsize it: ::

myclip = TextClip("Hello", fontsize=70, stroke_width=5).resize(height=15)


Expand Down Expand Up @@ -161,12 +161,12 @@ Video files (.mp4, .webm, .ogv...)
""""""""""""""""""""""""""""""""""""

To write a clip as a video file, use ::

my_clip.write_videofile("movie.mp4") # default codec: 'libx264', 24 fps
my_clip.write_videofile("movie.mp4",fps=15)
my_clip.write_videofile("movie.webm") # webm format
my_clip.write_videofile("movie.webm",audio=False) # don't render audio.

MoviePy has default codec names for the most common file extensions. If you want to use exotic formats or if you are not happy with the defaults you can provide the codec with ``codec='mpeg4'`` for instance. There are many many options when you are writing a video (bitrate, parameters of the audio writing, file size optimization, number of processors to use, etc.). Please refer to :py:meth:`~moviepy.video.VideoClip.VideoClip.write_videofile` for more.


Expand All @@ -187,19 +187,19 @@ To write your video as an animated GIF, use ::

Note that this requires ImageMagick installed. Otherwise you can also create the GIF with ffmpeg by adding the option ``program='ffmpeg'``, it will be much faster but won't look as nice and won't be optimized.

If the clip has a mask it will be used for transparency.
If the clip has a mask it will be used for transparency.

There are many options to optimize the quality and size of a gif (see :py:meth:`~moviepy.video.VideoClip.VideoClip.write_gif`)

Note that when editing gifs the best way to preview them is in the notebook as explained here: :ref:`ipython_display`

For examples of use, see `this blog post <http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python>`_ for informations on making GIFs from video files, and `this other post <http://zulko.github.io/blog/2014/09/20/vector-animations-with-python/>`_ for GIF animations with vector graphics.
For examples of use, see `this blog post <https://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python>`_ for informations on making GIFs from video files, and `this other post <https://zulko.github.io/blog/2014/09/20/vector-animations-with-python/>`_ for GIF animations with vector graphics.

Export images
"""""""""""""""

You can write a frame to an image file with ::

myclip.save_frame("frame.png") # by default the first frame is extracted
myclip.save_frame("frame.jpeg", t='01:00:00') # frame at time t=1h

Expand Down
Loading

0 comments on commit fe742ad

Please sign in to comment.