If MoviePy isn’t including audio in your final write_videofile clip, and you’re running MoviePy through Anaconda on Windows, then make sure Anaconda is installing and updating from the correct repo.

If you’re stuck using an old version of MoviePy, removing the -an argument in the file in the package library as described here might get it working.

Since 2021, MoviePy, the wonderful command line tool for video editing, hasn’t added audio to finished video clips when I’ve tried to use it. The original clip(s) will have audio, or I supply the audio in a separate clip, but the write_videofile function will not return a video clip with audio.

MoviePy will even generate a temp audio file, but not remux the audio into the final video file.

My workaround for this has been to take the temp audio file that MoviePy generates and use ffmpeg to combine the video and audio tracks. 🤦‍♂️

Today, I tried Googling the problem one more time which led me to a series of fixes I feel compelled to boost for any frustrated idiots like me who continue to use a command line video editor in 2023.

Google took me to a GitHub comment I hadn’t seen before.

ghost commented on Nov 2, 2019

I faced this issue as well on a project I’m currently working on and it seems like many people are facing this issue as well. For some people, by changing the audio encoding that did the trick and fixed the issue (such as #820). However, changing the audio encoding didn’t work for me, the only solution I found for this issue is one mentioned in #876 was to remove the -an from the file in \site-packages\moviepy-1.0.1-py3.7.egg\moviepy\video\io

After I removed the -an from there it all worked like a charm.

Comment out the `-an` argument on line 87 in the `` file in your MoviePy package directory.
The `-an` flag to be removed is highlighted in green.

Implementing this fix worked on the test files and scripts that previously returned clips without sounds. However, the GitHub issue was closed in March 2020, which raised the question why was I still having this issue? Since I first encountered the problem in 2021, I’ve updated updated my installed packages in Anaconda before each time I’ve attempted to run MoviePy.

When I attempted to check which version of MoviePy I had installed, I found this fun error:

`conda search -f moviepy` returns the following error: `PackagesNotFoundError: The following packages are not available from current channels: - moviepy`
Well that explains a lot.

It turns out MoviePy is in conda-forge, but not the official Anaconda repositories. More searching informed me that the standard conda update --all command does not update non-conda packages. The -c flag can be added to the command to include non-conda channels in your update. Like this: -c conda-forge.

Once I actually updated MoviePy, my test cases continued to work.

Maybe it’s time to install the free version of DaVinci Resolve….