Created
November 25, 2016 02:44
-
-
Save sljeff/64e035087c744342a9237d7f19104093 to your computer and use it in GitHub Desktop.
python. convert video to audio.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import moviepy.editor as mp | |
import sys | |
def convert(video_file_name, audio_file_name=None): | |
if audio_file_name is None: | |
audio_file_name = video_file_name + '.mp3' | |
try: | |
clip = mp.VideoFileClip(video_file_name) | |
clip.audio.write_audiofile(audio_file_name) | |
print('success') | |
except Exception as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment