Skip to content

Instantly share code, notes, and snippets.

@Yilmaz4
Created March 24, 2022 19:09
Show Gist options
  • Save Yilmaz4/e3926902755227e4fd35c32e1c066719 to your computer and use it in GitHub Desktop.
Save Yilmaz4/e3926902755227e4fd35c32e1c066719 to your computer and use it in GitHub Desktop.
Convert every single *.mp4 file to *.mp3 in the current directory
from moviepy.editor import * # Install with "pip install moviepy" command
import os
for file in [file for file in os.listdir() if os.path.splitext(file)[1] == ".mp4"]:
video = VideoFileClip(file)
video.audio.write_audiofile(os.path.splitext(file)[0] + ".mp3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment