1

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.

Sandipan
  • 683
  • 8
  • 25

1 Answers1

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