Welcome folks today in this blog post we will be using the
moviepy library to convert the mp4 video to mp3 audio file in python. All the full source code of the application is shown below.
In order to get started you need to install the below library
moviepy using the pip command as shown below
pip install moviepy
After this you need to make an
app.py file and copy paste the following code
from moviepy.editor import *
mp4_file = "video.mp4"
mp3_file = "audio.mp3"
videoclip = VideoFileClip(mp4_file)
audioclip = videoclip.audio
As you can see we are importing the
moviepy library and then we are using the
VideoFileClip method inside that we are converting
mp4 audio to mp3 audio file.