-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert.py
59 lines (33 loc) · 1.21 KB
/
convert.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import tkinter as tk
from tkinter import ttk
import moviepy.editor as mp
win = tk.Tk()
win.title('convert mp4 video to mp3 audio')
# label
app_title = ttk.Label(win, text='convert your mp4 video to mp3 audio')
app_title.grid(row=0, columnspan=3, sticky=tk.W)
#video label and entry
video_label = ttk.Label(win, text='Drop Your Video Location Here: ')
video_label.grid(row=1, column=0, sticky=tk.W)
# entry video location
video_file = tk.StringVar()
video_location = ttk.Entry(win, width=35, textvariable=video_file)
video_location.grid(row=1, column=1)
video_location.focus()
#audio file saving location
audio_label = ttk.Label(win, text='Save As: ')
audio_label.grid(row=2, column=0, sticky=tk.W)
# entry audio location
audio_file = tk.StringVar()
audio_location = ttk.Entry(win, width=35, textvariable=audio_file)
audio_location.grid(row=2, column=1)
# process Unit
def action():
video = video_file.get()
audio = audio_file.get()
clip = mp.VideoFileClip(video)
clip.audio.write_audiofile(audio)
#Process Button
process_btn = ttk.Button(win, text='''let's convert''', command=action)
process_btn.grid(row=3, column=1, sticky=tk.W)
win.mainloop()