Skip to content

Commit

Permalink
deploy: 9ff9d1a
Browse files Browse the repository at this point in the history
  • Loading branch information
Zulko committed Nov 27, 2024
1 parent 2fc03a1 commit 891b7ef
Show file tree
Hide file tree
Showing 44 changed files with 243 additions and 237 deletions.
2 changes: 1 addition & 1 deletion _modules/moviepy/audio/io/ffmpeg_audiowriter.html
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ <h1>Source code for moviepy.audio.io.ffmpeg_audiowriter</h1><div class="highligh
<span class="sd"> Size (width,height) in pixels of the output video.</span>

<span class="sd"> fps_input</span>
<span class="sd"> Frames per second of the input audio (given by the AUdioClip being</span>
<span class="sd"> Frames per second of the input audio (given by the AudioClip being</span>
<span class="sd"> written down).</span>

<span class="sd"> codec</span>
Expand Down
6 changes: 3 additions & 3 deletions _modules/moviepy/audio/io/ffplay_audiopreviewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ <h1>Source code for moviepy.audio.io.ffplay_audiopreviewer</h1><div class="highl
<span class="sd"> ----------</span>

<span class="sd"> fps_input</span>
<span class="sd"> Frames per second of the input audio (given by the AUdioClip being</span>
<span class="sd"> Frames per second of the input audio (given by the AudioClip being</span>
<span class="sd"> written down).</span>

<span class="sd"> nbytes:</span>
Expand All @@ -413,8 +413,8 @@ <h1>Source code for moviepy.audio.io.ffplay_audiopreviewer</h1><div class="highl
<span class="c1"># order is important</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">FFPLAY_BINARY</span><span class="p">,</span>
<span class="s2">&quot;-autoexit&quot;</span><span class="p">,</span> <span class="c1"># If you dont precise, ffplay dont stop at end</span>
<span class="s2">&quot;-nodisp&quot;</span><span class="p">,</span> <span class="c1"># If you dont precise a window is</span>
<span class="s2">&quot;-autoexit&quot;</span><span class="p">,</span> <span class="c1"># If you don&#39;t precise, ffplay won&#39;t stop at end</span>
<span class="s2">&quot;-nodisp&quot;</span><span class="p">,</span> <span class="c1"># If you don&#39;t precise a window is</span>
<span class="s2">&quot;-f&quot;</span><span class="p">,</span>
<span class="s2">&quot;s</span><span class="si">%d</span><span class="s2">le&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="mi">8</span> <span class="o">*</span> <span class="n">nbytes</span><span class="p">),</span>
<span class="s2">&quot;-ar&quot;</span><span class="p">,</span>
Expand Down
2 changes: 1 addition & 1 deletion _modules/moviepy/video/VideoClip.html
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@ <h1>Source code for moviepy.video.VideoClip</h1><div class="highlight"><pre>
<span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns a new clip in which just a rectangular subregion of the</span>
<span class="sd"> original clip is conserved. x1,y1 indicates the top left corner and</span>
<span class="sd"> x2,y2 is the lower right corner of the croped region.</span>
<span class="sd"> x2,y2 is the lower right corner of the cropped region.</span>
<span class="sd"> All coordinates are in pixels. Float numbers are accepted.</span>
<span class="sd"> For info on the parameters, please see ``vfx.Crop``</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand Down
6 changes: 3 additions & 3 deletions _modules/moviepy/video/io/ffplay_previewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ <h1>Source code for moviepy.video.io.ffplay_previewer</h1><div class="highlight"
<span class="c1"># order is important</span>
<span class="n">cmd</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">FFPLAY_BINARY</span><span class="p">,</span>
<span class="s2">&quot;-autoexit&quot;</span><span class="p">,</span> <span class="c1"># If you dont precise, ffplay dont stop at end</span>
<span class="s2">&quot;-autoexit&quot;</span><span class="p">,</span> <span class="c1"># If you don&#39;t precise, ffplay won&#39;t stop at end</span>
<span class="s2">&quot;-f&quot;</span><span class="p">,</span>
<span class="s2">&quot;rawvideo&quot;</span><span class="p">,</span>
<span class="s2">&quot;-pixel_format&quot;</span><span class="p">,</span>
Expand Down Expand Up @@ -482,9 +482,9 @@ <h1>Source code for moviepy.video.io.ffplay_previewer</h1><div class="highlight"

<span class="sd"> pixel_format : str, optional</span>
<span class="sd"> Warning: This is not used anywhere in the code and should probably</span>
<span class="sd"> be remove.</span>
<span class="sd"> be removed.</span>
<span class="sd"> It is believed pixel format rgb24 does not work properly for now because</span>
<span class="sd"> it require applying mask on CompositeVideoClip and thoses are believed to</span>
<span class="sd"> it requires applying a mask on CompositeVideoClip and that is believed to</span>
<span class="sd"> not be working.</span>

<span class="sd"> Pixel format for the output video file, ``rgb24`` for normal video, ``rgba``</span>
Expand Down
4 changes: 2 additions & 2 deletions _sources/developer_guide/developers_install.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation for MoviePy developers
======================================

.. warning::
This part is only destined to people who want to build the MoviePy documentation by themself, or to contribute to MoviePy, normal user dont need it.
This part is only destined to people who want to build the MoviePy documentation by themselves, or to contribute to MoviePy. Normal users don't need it.

In addition to MoviePy main libraries, MoviePy developers will also need to install additional libraries to be able to run MoviePy tests and build the MoviePy documentation.

Expand Down Expand Up @@ -40,7 +40,7 @@ Once libraries installed you can test with:
$ python -m pytest
And you can lint with :
And you can lint with:

.. code:: bash
Expand Down
6 changes: 3 additions & 3 deletions _sources/getting_started/FAQ.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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
don't work for you, please open a bug report on Github_, or on the dedicated forum on Reddit_.
don't work for you, please open a bug report on Github_, or on the dedicated Subreddit_.


MoviePy generated a video that cannot be read by my favorite player.
Expand All @@ -23,7 +23,7 @@ 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:`install`).


Expand All @@ -33,5 +33,5 @@ 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: https://www.reddit.com/r/moviepy/
.. _Subreddit: https://www.reddit.com/r/moviepy/

2 changes: 1 addition & 1 deletion _sources/getting_started/docker.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MoviePy Docker
Prerequisites
-------------

Docker installed `Docker for Mac, Docker for windows, linux, etc <https://www.docker.com/get-docker/>`_
Docker installed: `Docker Engine for Linux <https://docs.docker.com/engine/install/>`_ or `Docker Desktop for Windows/Mac/Linux <https://docs.docker.com/desktop/>`_.

Build the docker
-----------------
Expand Down
10 changes: 5 additions & 5 deletions _sources/getting_started/install.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Installation
==========================

Installation is done with ``pip`` if you dont have ``pip`` take a look at `how to install it <https://pip.pypa.io/en/stable/installation/>`_.
Installation is done with ``pip``. If you don't have ``pip``, take a look at `how to install it <https://pip.pypa.io/en/stable/installation/>`_.

With ``pip`` installed, just type this in a terminal :
With ``pip`` installed, just type this in a terminal:

.. code:: bash
Expand All @@ -21,14 +21,14 @@ MoviePy depends on the software ffmpeg_ for video reading and writing and on ``f

You don't need to worry about ffmpeg_, as it should be automatically downloaded/installed by ImageIO during your first use of MoviePy (it takes a few seconds).

You do need to worry ``ffplay`` if you plan on using video/audio previewing though. In such case, make sure to have ``ffplay`` installed (it can usually be found alongside ``ffmpeg``) and
make sure it is accessible to Python, or look how to set a custom path (see below).
You do need to worry about ``ffplay`` if you plan on using video/audio previewing. For these cases, make sure to have ``ffplay`` installed (it can usually be found alongside ``ffmpeg``) and
make sure it is accessible to Python, or define a custom path (see below).


Define custom paths to binaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to use a specific version of FFMPEG and FFPLAY, you can do so using environment variables.
If you want to use a specific version of FFmpeg and FFplay, you can do so using environment variables.

There are a couple of environment variables used by MoviePy that allow you to configure custom paths to the external tools.

Expand Down
22 changes: 11 additions & 11 deletions _sources/getting_started/moviepy_10_minutes.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In this tutorial, you will learn the basics of how to use the MoviePy library in

<div style="position: relative; padding-bottom: 56.25%; padding-top: 30px; margin-bottom:30px; height: 0; overflow: hidden; margin-left: 5%;">
<video controls>
<source src="/_static/medias/moviepy_10_minutes/tailer_bbb.mp4" type="video/mp4">
<source src="/moviepy/_static/medias/getting_started/moviepy_10_minutes/trailer_bbb.mp4" type="video/mp4">
<p>Your browser does not support HTML5 video in MP4 format.</p>
</video>
</div>
Expand Down Expand Up @@ -99,12 +99,12 @@ To do so, we are going to use the ``with_section_cut_out`` method to remove a po
:language: python
:lines: 41-54

In that particular case, we have used the ``with_section_cut_out``, but this is only one of the many clip manipulation methods starting with ``with_*``. We will see a few others
In that particular case, we have used the ``with_section_cut_out``, but this is only one of the many clip manipulation methods starting with ``with_``. We will see a few others
in this tutorial, but we will miss a lot more. If you want an exhaustive list, go see :ref:`reference_manual`.

.. note::
You may have noticed that we have reassigned the ``rodents_clip`` variable instead of just calling a method on it.
This is because in MoviePy, any function starting with ``with_*`` is out-of-place instead of in-place, meaning it does not modify the original data but instead copies it and modifies/returns the copy.
This is because in MoviePy, any function starting with ``with_`` is out-of-place instead of in-place, meaning it does not modify the original data but instead copies it and modifies/returns the copy.
So you need to store the result of the method and, if necessary, reassign the original variable to update your clip.


Expand Down Expand Up @@ -132,19 +132,19 @@ Feel free to experiment with different effects and transitions to achieve the de
Step 6: Timing the clips
--------------------------

We have all the clips we need, but if we were to combine all those clips into a single one using composition (we will see that in the next step), all our clips would start at the same time and play on top of each other, which is obviously not what we want.
Also, some video clips, like the images and texts, have no endpoint/duration at creation (except if you have provided a duration parameter), which means trying to render them will throw an error as it would result in an infinite video.
We have all the clips we need, but if we were to combine all the clips into a single one using composition (we will see that in the next step), all our clips would start at the same time and play on top of each other, which is obviously not what we want.
Also, some video clips, like images and texts, have no endpoint/duration at creation (unless you have provided a duration parameter), which means trying to render them will throw an error as it would result in an infinite video.

To fix that, we need to specify when a clip should start and stop in the final clip. So, let's start by indicating when each clip must start and end with the appropriate with_* methods.
To fix that, we need to specify when a clip should start and stop in the final clip. So, let's start by indicating when each clip must start and end using the appropriate with_* methods.

.. literalinclude:: /_static/code/getting_started/moviepy_10_minutes/trailer.py
:language: python
:lines: 85-111

.. note::
By default, all clips have a start point at ``0``. If a clip has no duration but you set the ``endtime``, then the duration will be calculated for you. The reciprocity is also true.
By default, all clips have a start point at ``0``. If a clip has no ``duration`` but you set the ``end_time``, then the ``duration`` will be calculated for you. The reciprocity is also true.

So in our case, we either use duration or endtime, depending on what is more practical for each specific case.
So in our case, we either use ``duration`` or ``end_time``, depending on what is more practical for each specific case.

Step 7: Seeing how all clips combine
--------------------------------------
Expand Down Expand Up @@ -211,7 +211,7 @@ Well, this looks a lot nicer! For this tutorial, we want to keep things simple,
For a more in-depth presentation, see :py:mod:`moviepy.video.fx`, :py:mod:`moviepy.audio.fx`, and :ref:`create_effects`.

.. note::
Looking at the result, you may notice that crossfading makes clips go from transparent to opaque, and reciprocally, and wonder how it works.
Looking at the result, you may notice that cross-fading makes clips go from transparent to opaque, and reciprocally, and wonder how it works.

We won't get into details, but know that in MoviePy, you can declare some sections of a video clip to be transparent by using masks. Masks are nothing more than
special kinds of video clips that are made of values ranging from ``0`` for a transparent pixel to ``1`` for a fully opaque one.
Expand All @@ -223,7 +223,7 @@ Step 10: Modifying the appearance of a clip using filters
--------------------------------------------------------------

Finally, to make it more epic, we will apply a custom filter to our Rambo clip to make the image sepia.
MoviePy does not come with a sepia effect out of the box, and creating a full custom effect is beyond the scope of this tutorial. However, we will see how we can apply a simple filter to our clip using the ``image_transform`` method.
MoviePy does not come with a sepia effect out of the box, and creating a full custom effect is beyond the scope of this tutorial. However, we will see how we can apply a simple filter to our clip using the :py:meth:`~moviepy.video.VideoClip.VideoClip.image_transform` method.

To understand how filters work, you first need to understand that in MoviePy, a clip frame is nothing more than a numpy ``ndarray`` of shape ``HxWx3``.
This means we can modify how a frame looks like by applying simple math operations. Doing that on all the frames allows us to apply a filter to our clip!
Expand All @@ -248,7 +248,7 @@ Step 11: Rendering the final clip to a file
So, our final clip is ready, and we have made all the cutting and modifications we want. We are now ready to save the final result into a file. In video editing, this operation
is known as rendering.

Again, we will keep things simple and just do video rendering without much tweaking. In most cases, MoviePy and FFMPEG automatically find the best settings. Take a look at the ``write_videofile`` doc for more info.
Again, we will keep things simple and just do video rendering without much tweaking. In most cases, MoviePy and FFmpeg will automatically find the best settings. Take a look at :py:meth:`~moviepy.video.VideoClip.VideoClip.write_videofile` for more info.

.. literalinclude:: /_static/code/getting_started/moviepy_10_minutes/trailer.py
:language: python
Expand Down
17 changes: 10 additions & 7 deletions _sources/getting_started/quick_presentation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Here are a few reasons why you may want to edit videos in Python:
And here are a few uses for which MoviePy is NOT the best solution:

- You only need to do frame-by-frame video analysis (with face detection or other fancy stuff). This could be done with MoviePy in association with other libraries, but really, just use imageio_, OpenCV_ or SimpleCV, these are libraries that specialize in these tasks.
- You only want to convert a video file, or turn a series of image files into a movie. In this case it is better to directly call ``ffmpeg`` (or ``avconv`` or ``mencoder``...) it will be faster more memory-efficient than going through MoviePy.
- You only want to convert a video file, or turn a series of image files into a movie. In this case it is better to directly call ``ffmpeg`` (or ``avconv`` or ``mencoder``...) as it will be faster and more memory-efficient than going through MoviePy.


Advantages and limitations
Expand All @@ -29,9 +29,12 @@ MoviePy has been developed with the following goals in mind:

- **Simple and intuitive**. Basic operations can be done in one line. The code is easy to learn and easy to understand for newcomers.
- **Flexible**. You have total control over the frames of the video and audio, and creating your own effects is easy as Py.
- **Portable**. The code uses very common software (Numpy and FFMPEG) and can run on (almost) any machine with (almost) any version of Python.
- **Portable**. The code uses very common software (Numpy and FFmpeg) and can run on (almost) any machine with (almost) any version of Python.

For the limitations: MoviePy cannot (yet) stream videos (read from a webcam, or render a video live on a distant machine), and is not really designed for video processing involving many successive frames of a movie (like video stabilization, you'll need another software for that). You can also have memory problems if you use many video, audio, and image sources at the same time (>100), but this will be fixed in future versions.
Limitations:
- MoviePy cannot stream videos (e.g. reading from a webcam, or rendering a video live on a distant machine).
- MoviePy is not really designed for video processing involving many successive frames of a movie (e.g. video stabilization - there is other software better suited for that).
- You can also have memory problems if you use many video, audio, and image sources at the same time (>100).

Example code
~~~~~~~~~~~~~~
Expand All @@ -57,18 +60,18 @@ Internally, the representation and manipulation of the different media is done u
The central concept, the clips
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The central object of MoviePy is the :py:class:`the clips <moviepy.Clip.Clip>`, with either :py:class:`~moviepy.audio.AudioClip.AudioClip` for any audio element, or :py:class:`~moviepy.video.VideoClip.VideoClip` for any visual element. Clips really are the base unit of MoviePy, everything you do is with and on them.
The central object of MoviePy is the the :py:class:`Clip <moviepy.Clip.Clip>`, with either :py:class:`~moviepy.audio.AudioClip.AudioClip` for any audio element, or :py:class:`~moviepy.video.VideoClip.VideoClip` for any visual element. Clips really are the base unit of MoviePy, everything you do is with and on them.

Clips can be created from more than just videos or audios though. They can also be created from an image, a text, a custom animation, a folder of images, and even a simple lambda function !
Clips can be created from more than just videos or audios though. They can also be created from an image, a text, a custom animation, a folder of images, and even a simple lambda function!

To create your final video, what you will do is essentially :
To create your final video, what you will do is essentially:

#. Load different resources as clips (see :ref:`loading`)
#. Modify them (see :ref:`modifying`)
#. Mixing them into one final clip (see :ref:`compositing`)
#. Render them into a file (see :ref:`rendering`)

Of course, MoviePy offer multiple handy solution and tools to facilitate all thoses steps, and let you add new ones by writing your own effects (see :ref:`create_effects`) !
Of course, MoviePy offer multiple handy solution and tools to facilitate all these steps, and lets you add new ones by writing your own effects (see :ref:`create_effects`)!


.. _imageio: https://imageio.github.io/
Expand Down
Loading

0 comments on commit 891b7ef

Please sign in to comment.