Skip to content

WebNinjaDeveloper.com

Programming Tutorials




Menu
  • Home
  • Youtube Channel
  • Official Blog
  • Nearby Places Finder
  • Direction Route Finder
  • Distance & Time Calculator
Menu

Python 3 Moviepy Script to Convert Mp4 Video to Mp3 Audio in Command Line

Posted on December 19, 2022

 

 

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.

 

 

Get Started

 

 

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

 

 

app.py

 

 

Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from moviepy.editor import *
 
mp4_file = "video.mp4"
 
mp3_file = "audio.mp3"
 
videoclip = VideoFileClip(mp4_file)
 
audioclip = videoclip.audio
 
audioclip.write_audiofile(mp3_file)
 
audioclip.close()
 
videoclip.close()

 

 

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.

 

 

 

Recent Posts

  • Android Java Project to Download Multiple Images From URL With Progressbar & Save it inside Gallery
  • Android Java Project to Capture Image From Camera & Save it inside Gallery
  • Android Java Project to Crop,Scale & Rotate Images Selected From Gallery and Save it inside SD Card
  • Android Kotlin Project to Load Image From URL into ImageView Widget
  • Android Java Project to Make HTTP Call to JSONPlaceholder API and Display Data in RecyclerView Using GSON & Volley Library
  • Angular
  • Bunjs
  • C#
  • Deno
  • django
  • Electronjs
  • java
  • javascript
  • Koajs
  • kotlin
  • Laravel
  • meteorjs
  • Nestjs
  • Nextjs
  • Nodejs
  • PHP
  • Python
  • React
  • ReactNative
  • Svelte
  • Tutorials
  • Vuejs




©2023 WebNinjaDeveloper.com | Design: Newspaperly WordPress Theme