Skip to content

Commit 074fc18

Browse files
committed
added new script to convert vodeo from audio
1 parent af85aa6 commit 074fc18

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
__pycache__/
22
/tests/dice/
3+
4+
Pipfile
5+
Pipfile.lock

extract_audio_from_video.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import moviepy.editor
2+
from pathlib import Path
3+
4+
5+
try:
6+
video_file = 'tests/video.mp4'
7+
video = moviepy.editor.VideoFileClip(video_file)
8+
except:
9+
print(f"Videofile {video_file} was not found")
10+
exit()
11+
12+
try:
13+
audio = video.audio
14+
audio_file = video_file + '.mp3'
15+
audio.write_audiofile(audio_file)
16+
except:
17+
print(f"Can't save audio into {audio_file}")

tests/video.mp4

1.88 MB
Binary file not shown.

tests/video.mp4.mp3

113 KB
Binary file not shown.

0 commit comments

Comments
 (0)