The below code can help you in solving your problem.
Run this code using python3 in Your command prompt or any python IDE. Before that install python interpreter in your machine.
import os
try:
import moviepy
except ImportError:
print("Installing required modules")
os.system('python -m pip install moviepy')
print("successfully installed required modules")
import moviepy.editor as mp
try:
# Enter video file path in mp4 format
mp3=mp.VideoFileClip(r"Videofile.mp4")
except FileNotFoundError:
print("Enter the correct Video file path")
finally:
# Enter the audio file to create in mp3 format
mp3.audio.write_audiofile(r"audiofile.mp3")
print("Video file successfully converted to Audio file")
-> All the best, and continue for your success
No comments:
Post a Comment