I am trying to extract the audio file from a video file and save it to a wav file and then again combine the audio and video together in python3. I have found many tutorials using ffmpeg
but I don't want to use any external tool to do the task. It will be helpful if someone gives me any suggestion on how to do it in python. Thank you.
Asked
Active
Viewed 3,011 times
1

Sandipan
- 683
- 8
- 25
1 Answers
2
read this site for instructions https://medium.com/@steadylearner/how-to-extract-audio-from-the-video-with-python-aea325f434b6
import sys
from moviepy.editor import *
video = VideoFileClip(sys.argv[1])
audio = video.audio
audio.write_audiofile(sys.argv[2])
//1. Save this file as extract_audio.py
//2. Type $python extract_audio.py video_for_audio.mp4 audio_from_video.mp4

Sandipan
- 683
- 8
- 25

Altair Elias
- 31
- 4
-
it says `audio` is `NONE TYPE` – Sandipan Apr 28 '19 at 16:16
-
I got RuntimeError: imageio.ffmpeg.download() has been deprecated. Use 'pip install imageio-ffmpeg' instead.' – Louie Lee Feb 01 '20 at 01:11