Question : mp4 to mp3 code
Answered by :
import os
from moviepy.editor import *
video = VideoFileClip(os.path.join("path","to","movie.mp4"))
video.audio.write_audiofile(os.path.join("path","to","movie_sound.mp3"))
Just replace "path","to","movie.mp4" and "path","to","movie_sound.mp3" according to your needs.
EDIT: To avoid the KeyError: 'video_fps', do ensure that you aren't inputting any video which does not contain any visual content.
Source to this: https://stackoverflow.com/questions/55081352/how-to-convert-mp4-to-mp3-using-python
Source : https://stackoverflow.com/questions/55081352/how-to-convert-mp4-to-mp3-using-python | Last Update : Sat, 17 Sep 22