Python for convert video to audio
Python code for converting Video file to Audio file.
Code
# pip install moviepy
import moviepy.editor
# replace the parameter with the location of video
video = moviepy.editor.VideoFileClip("path\vid_filename.mp4")
audio_data = video.audio
# replace the parameter with location
# along with filename
audio_data.write_audiofile("path\aud_filename.mp3")
import moviepy.editor
# replace the parameter with the location of video
video = moviepy.editor.VideoFileClip("path\vid_filename.mp4")
audio_data = video.audio
# replace the parameter with location
# along with filename
audio_data.write_audiofile("path\aud_filename.mp3")
How to Run
1. Copy the code.
2. Paste the code in your Python IDE or Notepad file.
3. Save the file in filename.py format.
4. Open a Terminal or cmd to current working directory.
5. Type python filename.py and hit Enter.
0 Comments