forked from keplerlab/katna
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_video_compression.py
More file actions
38 lines (28 loc) · 919 Bytes
/
example_video_compression.py
File metadata and controls
38 lines (28 loc) · 919 Bytes
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
import os
import os.path
import cv2
from Katna.video import Video
def main():
vd = Video()
# folder to save extracted images
output_folder_video_image = "compressed_folder"
out_dir_path = os.path.join(".", output_folder_video_image)
if not os.path.isdir(out_dir_path):
os.mkdir(out_dir_path)
# Video file path
video_file_path = os.path.join(".", "tests", "data", "pos_video.mp4")
print(f"Input video file path = {video_file_path}")
status = vd.compress_video(
file_path=video_file_path,
out_dir_path=out_dir_path
)
# Video folder path
video_folder_path = os.path.join(".", "tests", "data")
print(f"Input video folder path = {video_folder_path}")
status = vd.compress_videos_from_dir(
dir_path=video_folder_path,
force_overwrite=True,
out_dir_path=out_dir_path
)
if __name__ == "__main__":
main()