forked from idlegene/HEVC-deep-learning-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_frames.py
28 lines (27 loc) · 797 Bytes
/
gen_frames.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
import os
import shutil
with open("bitstream.cfg",'r') as f:
for i,line in enumerate(f):
line = line.split(":")
if i == 0:
yuv_file = ":".join(line[1:]).strip(" ").strip('\n')
elif i == 3:
frame_rate = line[1].strip(" ").strip('\n')
elif i == 5:
yuv_width = line[1].strip(" ").strip('\n')
elif i == 6:
yuv_height = line[1].strip(" ").strip('\n')
else:
pass
try:
os.mkdir("./rec/frames")
except:
print('cant create frames')
pass
gen_frames_cmd = "ffmpeg -video_size {}x{} -r {} -pixel_format yuv420p -i {} .\\rec\\frames\\%d.jpg".format(yuv_width,yuv_height,frame_rate,yuv_file)
os.system(gen_frames_cmd)
try:
shutil.rmtree("./pred")
except:
pass
os.mkdir("./pred")