Manim: How to add sound to video?

Created on 29 Jul 2019  ·  15Comments  ·  Source: 3b1b/manim

Most helpful comment

I think you need to learn how to write on Markdown to express yourself better, here is a quick tutorial.

Technically it does work, the problem is the shell used by Windows 8 and 10. You have to learn to read the terminal, it is telling you that on line 363 in manimlib/scene/scene_file_writer.py (In the current version it is 354, so I guess you are using a backward version), the process subprocess.call([" rm ", sound_file_path]) is not recognized, so you must replace it with a command compatible with the shell you use, it worked for me os.remove(sound_file_path), so replace the line 363 of that file with os.remove(sound_file_path).

All 15 comments

Hi @girishgargcool, I hope you are doing well.

Unfortunately, there is no such feature in manim as it is a tool intended only for animation. A quote from the creator:

I also get worried when I hear people ask things like “how do I sync up narration into manim”. This is just a tool for spitting out the individual mathematical animations, not the whole video. For goodness sake, use traditional video editing software for as much as you can!

I get that you want to just add some audio to your recently made animation, so I would recommend you to use a proper video editing software. :)

Use self.add_sound(file_name).

Create a folder called assets, and inside create another folder called sounds. In the sounds folder, place the .wav or .mp3 tracks. It is only recommended to use short sounds. Here an example.

assets folder has to be created in the manim folder itself or any sub-folders?

In the manim folder itself.

doesnot work
Screenshot (61)

self.add_sound("audio")

class test6(Scene):
def construct(self):
formula1=TexMobject("y\quad =\quad f(x)")
formula2=TexMobject(r"\frac{d}{dx}f(x)\quad =\quad\lim_{h\to 0}{f(x+h)\quad-\quad f(x) \over ", r"(x+h)\quad-\quad(x)","}")
formula3=TexMobject(r"\frac{d}{dx}f(x)\quad =\quad\lim_{h\to 0}{f(x+h)\quad-\quad f(x) \over ","h","}")

    formula1.set_color(RED)
    formula2.set_color(BLUE)
    formula3.set_color(BLUE)
    self.add_sound("audio")

    self.play(Write(formula1), run_time=3)
    self.play(ApplyMethod(formula1.shift, 3*LEFT + 3*UP))
    self.wait()
    #
    self.play(Write(formula2), run_time=5)
    self.wait(3)
    #
    self.play(Transform(formula2[1], formula3[1]))
    self.wait(5)

I think you need to learn how to write on Markdown to express yourself better, here is a quick tutorial.

Technically it does work, the problem is the shell used by Windows 8 and 10. You have to learn to read the terminal, it is telling you that on line 363 in manimlib/scene/scene_file_writer.py (In the current version it is 354, so I guess you are using a backward version), the process subprocess.call([" rm ", sound_file_path]) is not recognized, so you must replace it with a command compatible with the shell you use, it worked for me os.remove(sound_file_path), so replace the line 363 of that file with os.remove(sound_file_path).

If you have this error you can solve it with this.

Thank you so much

Please suggest a free video and audio editor

Video: Blender
Some tutorials

Audio: Reaper

I think you need to learn how to write on Markdown to express yourself better, here is a quick tutorial.

Technically it does work, the problem is the shell used by Windows 8 and 10. You have to learn to read the terminal, it is telling you that on line 363 in manimlib/scene/scene_file_writer.py (In the current version it is 354, so I guess you are using a backward version), the process subprocess.call([" rm ", sound_file_path]) is not recognized, so you must replace it with a command compatible with the shell you use, it worked for me os.remove(sound_file_path), so replace the line 363 of that file with os.remove(sound_file_path).

@zavden
If subprocess.call([" rm ", sound_file_path]) doesn't work for win10,
why don't push a Pr replace it with os.remove(sound_file_path)

You can use as an audio/video editor OpenShot Video Editor, free and functional

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kolibril13 picture kolibril13  ·  4Comments

Planeuge picture Planeuge  ·  6Comments

OGALI picture OGALI  ·  3Comments

purusharths picture purusharths  ·  4Comments

GrouperTamaki picture GrouperTamaki  ·  5Comments