Convert MP4 To MP3 Using Python

If you are struggling to find a free tool to convert your mp4 to mp3, this article is right for you.

Convert MP4 To MP3 Using Python

This article would be concise as converting mp4 to mp3 is just three lines of code:)

Let’s start the magic.

Required Package

To perform this conversion, one needs to install a Python package named moviepy, and it can be done using the following pip command:

pip install moviepy

Code To Convert MP4 To MP3

Once the required package is installed, it is just a matter of writing a few lines of code:

import moviepy.editor as ed
video = ed.VideoFileClip(‘test.mp4’)
video.audio.write_audiofile(‘test.mp3’)

I hope you enjoyed writing such a useful utility. Make sure to check out my video demonstrating the same.


Recommended Free Ebook
Similar Articles