Skip to content

Commit

Permalink
Added support for ffv1 lossless encoding and set it as the default fo…
Browse files Browse the repository at this point in the history
…rmat. After testing, its compression ratio is higher than PNG.
  • Loading branch information
KegangWangCCNU authored Aug 17, 2023
1 parent 40fa556 commit 9ed50e6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def record():
p = f'{dir_path}/video_RAW_RGBA.avi'
if i=='MJPG':
p = f'{dir_path}/video_ZIP_MJPG.avi'
if i=='FFV1':
p = f'{dir_path}/video_ZIP_RAW_BGRA.avi'
if i=='PNGS':
png = f'{dir_path}/pictures_ZIP_RAW_RGB/'
if not os.path.exists(png):
Expand Down Expand Up @@ -324,7 +326,7 @@ def f(x, writer=writer):
sel4.place(x=5, y=240+diff)
sel5 = tk.Radiobutton(window, text='YUY2', variable=v2, value='YUY2')
sel5.place(x=65, y=240+diff)
sel4.select()
sel5.select()

lb12 = tk.Label(window, text='file codec', font=('Times',15))
lb12.place(x=0, y=260+diff)
Expand All @@ -333,17 +335,20 @@ def f(x, writer=writer):
ck3_v = tk.StringVar()
ck4_v = tk.StringVar()
ck5_v = tk.StringVar()
ck6_v = tk.StringVar()
ck1 = tk.Checkbutton(window, text='H264', onvalue='avc1', offvalue='', variable=ck1_v)
ck2 = tk.Checkbutton(window, text='I420', onvalue='I420', offvalue='', variable=ck2_v)
ck3 = tk.Checkbutton(window, text='RGBA', onvalue='RGBA', offvalue='', variable=ck3_v)
ck4 = tk.Checkbutton(window, text='MJPG', onvalue='MJPG', offvalue='', variable=ck4_v)
ck5 = tk.Checkbutton(window, text='PNGS', onvalue='PNGS', offvalue='', variable=ck5_v)
ck6 = tk.Checkbutton(window, text='FFV1', onvalue='FFV1', offvalue='', variable=ck6_v)
ck1.place(x=5, y=280+diff)
ck2.place(x=65, y=280+diff)
ck3.place(x=125, y=280+diff)
ck4.place(x=5, y=300+diff)
ck5.place(x=65, y=300+diff)
ck1.select()
ck6.place(x=125, y=300+diff)
ck6.select()

def f_lb():
global res, fourcc, fps, save_fourcc, cam_id
Expand Down Expand Up @@ -375,7 +380,7 @@ def f_lb():
fps = 10
if res == [640, 480]:
fps = 30
save_fourcc = [i for i in (ck1_v.get(), ck2_v.get(), ck3_v.get(), ck4_v.get(), ck5_v.get()) if i]
save_fourcc = [i for i in (ck1_v.get(), ck2_v.get(), ck3_v.get(), ck4_v.get(), ck5_v.get(), ck6_v.get()) if i]
window.after(100, f_lb)
f_lb()
if __name__ == '__main__':
Expand Down

0 comments on commit 9ed50e6

Please sign in to comment.