πŸŽžοΈλ™μ˜μƒ

1. λ™μ˜μƒ 파일 μ½μ–΄μ„œ ν‘œμ‹œ

from helloai import *
import os 

win = Window('hello-AI')

video_path = "C:\\Users\\user\\Downloads\\videos\\video.mp4"
video_reader = VideoReader(video_path)

# λΉ„λ””μ˜€ 정보 좜λ ₯
info = video_reader.get_info()
print("Video Info:", info)

def loop():
    # λ™μ˜μƒμ—μ„œ ν”„λ ˆμž„ ν•œκ°œ 읽음
    frame = video_reader.read()

    # λ™μ˜μƒμ΄ λκΉŒμ§€ μž¬μƒ
    if video_reader.end_:
        stop()    # ν”„λ‘œκ·Έλž¨ μ’…λ£Œ 

    win.show(frame)

# ν”„λ‘œκ·Έλž¨μ΄ λλ‚ λ•Œ μ΅œμ’…μ μœΌλ‘œ μ‹€ν–‰λ˜λŠ” ν•¨μˆ˜ 
def end():
    # λ™μ˜μƒμ˜ μ΅œμ’… 마무리λ₯Ό μœ„ν•΄μ„œ λ°˜λ“œμ‹œ ν•„μš” 
    video_reader.release()

# ----------------------------------------
if __name__ == '__main__':
    run()

Last updated