|
| 1 | +########################### |
| 2 | +Adding Voiceovers to Videos |
| 3 | +########################### |
| 4 | + |
| 5 | +Creating a full-fledged video with voiceovers is a bit more involved than |
| 6 | +creating purely visual Manim scenes. One has to use `a video editing |
| 7 | +program <https://en.wikipedia.org/wiki/List_of_video_editing_software>`__ |
| 8 | +to add the voiceovers after the video has been rendered. This process |
| 9 | +can be difficult and time-consuming, since it requires a lot of planning |
| 10 | +and preparation. |
| 11 | + |
| 12 | +To ease the process of adding voiceovers to videos, we have created |
| 13 | +`Manim Voiceover <https://voiceover.manim.community>`__, a plugin |
| 14 | +that lets you add voiceovers to scenes directly in Python. To install it, run |
| 15 | + |
| 16 | +.. code-block:: bash |
| 17 | +
|
| 18 | + pip install "manim-voiceover[azure,gtts]" |
| 19 | +
|
| 20 | +Visit `the installation page <https://voiceover.manim.community/en/latest/installation.html>`__ |
| 21 | +for more details on how to install Manim Voiceover. |
| 22 | + |
| 23 | +Basic Usage |
| 24 | +########### |
| 25 | + |
| 26 | +Manim Voiceover lets you ... |
| 27 | + |
| 28 | +- Add voiceovers to Manim videos directly in Python, without having to use a video editor. |
| 29 | +- Record voiceovers with your microphone during rendering through a simple command line interface. |
| 30 | +- Develop animations with auto-generated AI voices from various free and proprietary services. |
| 31 | + |
| 32 | +It provides a very simple API that lets you specify your voiceover script |
| 33 | +and then record it during rendering: |
| 34 | + |
| 35 | +.. code-block:: python |
| 36 | +
|
| 37 | + from manim import * |
| 38 | + from manim_voiceover import VoiceoverScene |
| 39 | + from manim_voiceover.services.recorder import RecorderService |
| 40 | +
|
| 41 | + # Simply inherit from VoiceoverScene instead of Scene to get all the |
| 42 | + # voiceover functionality. |
| 43 | + class RecorderExample(VoiceoverScene): |
| 44 | + def construct(self): |
| 45 | + # You can choose from a multitude of TTS services, |
| 46 | + # or in this example, record your own voice: |
| 47 | + self.set_speech_service(RecorderService()) |
| 48 | +
|
| 49 | + circle = Circle() |
| 50 | +
|
| 51 | + # Surround animation sections with with-statements: |
| 52 | + with self.voiceover(text="This circle is drawn as I speak.") as tracker: |
| 53 | + self.play(Create(circle), run_time=tracker.duration) |
| 54 | + # The duration of the animation is received from the audio file |
| 55 | + # and passed to the tracker automatically. |
| 56 | +
|
| 57 | + # This part will not start playing until the previous voiceover is finished. |
| 58 | + with self.voiceover(text="Let's shift it to the left 2 units.") as tracker: |
| 59 | + self.play(circle.animate.shift(2 * LEFT), run_time=tracker.duration) |
| 60 | +
|
| 61 | +To get started with Manim Voiceover, |
| 62 | +visit the `Quick Start Guide <https://voiceover.manim.community/en/latest/quickstart.html>`__. |
| 63 | + |
| 64 | +Visit the `Example Gallery <https://voiceover.manim.community/en/latest/examples.html>`__ |
| 65 | +to see some examples of Manim Voiceover in action. |
0 commit comments