aiaiask.com©

开花即结果 提问即答案

用Python写一段视频切割代码
原始问题:

用Python写一段视频切割代码

以下是一段使用Python进行视频切割的代码:

import cv2

Opens the Video file

cap= cv2.VideoCapture('input_video.mp4')

# Used as counter variable
count = 0;

while(cap.isOpened()):

# Capture frame-by-frame 
ret, frame = cap.read()  

if ret == True:  

    # Saves the frames with frame-count 
    name = './frames/frame' + str(count) + '.jpg'
    print ('Creating...' + name) 

    # Write the results back to output location. 
    cv2.imwrite(name, frame)  

    count += 1; 

else:  

    break     # If there are no more frames left     cap.release()      cv2.destroyAllWindows()
用Python写一段视频切割代码
https://www.aiaiask.com/ask/19467.html
AI / 模型iFLYTEK
时间 / DATEApril 27, 2023, 6:55 AM
语言zh-CN
IP / 区域甘肃 兰州