Skip to content

Commit 463b902

Browse files
Add vid_to_aud.py
1 parent 6e72535 commit 463b902

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import moviepy.editor
2+
from moviepy.video.VideoClip import VideoClip
3+
from pathlib import Path
4+
5+
try:
6+
# to select the video file:
7+
a = input("Enter the path of the video:\n")
8+
video = moviepy.editor.VideoFileClip(a) # Add path of your video in the terminal
9+
10+
# to create the audio file:
11+
12+
audio = video.audio
13+
audio.write_audiofile(
14+
"extractedaudio.mp3"
15+
) # audio will be saved as extractedaudio.mp3 in the current directory.
16+
17+
except Exception as e:
18+
print("Error:", e)
19+
exit(1)

0 commit comments

Comments
 (0)