Skip to content

Commit f867c51

Browse files
authored
Added file size and images are bigger
1 parent bd546f0 commit f867c51

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

VVC_GUI_Encoder.py

+26-15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
global fin,fn,ext,filename
1111
global fin2,filename2
1212
def SelectButton():
13+
global filesize1
1314
global fps
1415
global height
1516
global width
@@ -19,12 +20,14 @@ def SelectButton():
1920
fin='"'+filename+'"'
2021
fin2=fin
2122
filename2=filename
23+
filesize1 = str(round(os.path.getsize(filename) / (1024*1024),2))
24+
fs1.config(text = 'Size(Mb): '+filesize1)
2225
os.system('ffmpeg_vvceasy.exe -y -i '+fin+' -vf thumbnail -frames:v 1 '+fin+'.jpg')
2326
imgone=Image.open(filename+'.jpg')
2427
if imgone.size[0] >= imgone.size[1]:
25-
wpercent = (160/float(imgone.size[0]))
28+
wpercent = (180/float(imgone.size[0]))
2629
hsize = int((float(imgone.size[1])*float(wpercent)))
27-
i=ImageTk.PhotoImage(imgone.resize((160,hsize)))
30+
i=ImageTk.PhotoImage(imgone.resize((180,hsize)))
2831
else:
2932
wpercent = (200/float(imgone.size[1]))
3033
wsize = int((float(imgone.size[0])*float(wpercent)))
@@ -39,7 +42,7 @@ def SelectButton():
3942
height = int(cv2.VideoCapture(filename).get(cv2.CAP_PROP_FRAME_HEIGHT))
4043
width = int(cv2.VideoCapture(filename).get(cv2.CAP_PROP_FRAME_WIDTH))
4144
def EncodeButton():
42-
global ii,fin2,filename2
45+
global ii,fin2,filename2,filesize2
4346
prst=preset.get()
4447
pss=passes.get()
4548
filename2=saveto.get()
@@ -58,17 +61,19 @@ def EncodeButton():
5861
os.system("mp4box.exe -add "+fin2+" -add "+fin2+"_266.jpg -new "+fin2)
5962
imgtwo=Image.open(filename2+'_266.jpg')
6063
if imgtwo.size[0] >= imgtwo.size[1]:
61-
wpercent = (160/float(imgtwo.size[0]))
64+
wpercent = (180/float(imgtwo.size[0]))
6265
hsize = int((float(imgtwo.size[1])*float(wpercent)))
63-
ii=ImageTk.PhotoImage(imgtwo.resize((160,hsize)))
66+
ii=ImageTk.PhotoImage(imgtwo.resize((180,hsize)))
6467
else:
6568
wpercent = (200/float(imgtwo.size[1]))
6669
wsize = int((float(imgtwo.size[0])*float(wpercent)))
6770
ii=ImageTk.PhotoImage(imgtwo.resize((wsize,200)))
68-
canvas.create_image(170, 0, anchor='nw', image=ii)
69-
os.remove(filename2+"_266.jpg")
71+
canvas.create_image(180, 0, anchor='nw', image=ii)
7072
os.remove(filename2+".Y4M")
7173
os.remove(fn+"."+ext+".m4a")
74+
os.remove(filename2+"_266.jpg")
75+
filesize2 = str(round(os.path.getsize(filename2) / (1024*1024),2))
76+
fs2.config(text = 'Size(Mb): '+filesize2)
7277
def btnClickFunctiontwo():
7378
global fin2, filename2
7479
data = [("mp4","*.mp4")]
@@ -90,33 +95,39 @@ def btnClickFunctiontwo():
9095
Label(root,text='1 pass / 2 pass', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=9, y=188)
9196
Label(root,text='1 Pass', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=169, y=8)
9297
Label(root,text='2 Pass', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=329, y=8)
93-
Label(root,text='Quality (1-63)', bg='#F0F8FF', font=('arial', 10, 'italic')).place(x=169, y=38)
94-
Label(root,text='Quality (kb)', bg='#F0F8FF', font=('arial', 10, 'italic')).place(x=329, y=38)
98+
Label(root,text='Quality (1-63)', bg='#F0F8FF', font=('arial', 10, 'italic')).place(x=169, y=28)
99+
Label(root,text='Quality (kb)', bg='#F0F8FF', font=('arial', 10, 'italic')).place(x=329, y=28)
100+
95101
Label(root,text='Save as:', bg='#F0F8FF', font=('arial', 12, 'normal')).place(x=39, y=248)
96102

103+
fs1=Label(root,text='Size(Mb):', bg='#F0F8FF', font=('arial', 10, 'italic'))
104+
fs1.place(x=129, y=288)
105+
fs2=Label(root,text='Size(Mb):', bg='#F0F8FF', font=('arial', 10, 'italic'))
106+
fs2.place(x=310, y=288)
107+
97108
videoselect=Entry(root)
98109
videoselect.place(x=9,y=38)
99110

100111
saveto=Entry(root,width=65)
101112
saveto.place(x=9,y=318)
102113

103-
preset=ttk.Combobox(root, values=['faster','fast','medium','slow','slower'],font=('arial',12,'normal'),width=10,state ="readonly")
114+
preset=ttk.Combobox(root, values=['faster','fast','medium','slow','slower'],font=('arial',12,'normal'),width=6,state ="readonly")
104115
preset.place(x=9,y=148)
105116
preset.current(1)
106117

107-
passes=ttk.Combobox(root,values=['1 pass', '2 pass'],font=('arial',12,'normal'),width=10,state="readonly")
118+
passes=ttk.Combobox(root,values=['1 pass', '2 pass'],font=('arial',12,'normal'),width=6,state="readonly")
108119
passes.place(x=9,y=218)
109120
passes.current(0)
110121

111122
quality=Spinbox(root,from_=1,to=63,font=('arial',10,'italic'),bg='#F0F8FF',width=10)
112-
quality.place(x=169,y=58)
123+
quality.place(x=169,y=48)
113124
quality.insert(0,3)
114125

115126
qualitytwo=Entry(root)
116-
qualitytwo.place(x=329,y=58)
127+
qualitytwo.place(x=329,y=48)
117128
qualitytwo.insert(0,500)
118129

119-
canvas=tk.Canvas(root,width=330,height=200)
120-
canvas.place(x=159,y=88)
130+
canvas=tk.Canvas(root,width=360,height=200)
131+
canvas.place(x=129,y=78)
121132

122133
root.mainloop()

0 commit comments

Comments
 (0)