-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_name.py
65 lines (46 loc) · 1.64 KB
/
file_name.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
60
61
62
63
64
65
import os
#path_dir = '/home/work/golf/FineGymData/data_folder'
#file_list = os.listdir(path_dir)
def name_changer(file_list, dir):
for file in file_list:
os.rename(dir+file, dir+file+".mp4")
import cv2
def video_info(infilename):
cap = cv2.VideoCapture(infilename)
if not cap.isOpened():
infilename = infilename.split(".")[0]+".mkv"
cap = cv2.VideoCapture(infilename)
if not cap.isOpened():
print("could not open :", infilename)
exit(0)
print(infilename)
length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = cap.get(cv2.CAP_PROP_FPS)
print('length : ', length)
print('width : ', width)
print('height : ', height)
print('fps : ', fps)
def video_duration(infilename):
cap = cv2.VideoCapture(infilename)
if not cap.isOpened():
infilename = infilename.split(".")[0]+".mkv"
cap = cv2.VideoCapture(infilename)
if not cap.isOpened():
print("could not open :", infilename)
exit(0)
print(infilename)
length = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = cap.get(cv2.CAP_PROP_FPS)
duration = length / fps
print('dutation : ', duration)
print('length : ', length)
print('width : ', width)
print('height : ', height)
print('fps : ', fps)
return duration
#video_info("/home/work/golf/FineGymData/movie/Wu1gxxpbF2o.mp4")
# 해상도는 640*360, fps는 25~30가량인거 같다.