返回

Python笔记本卡在将图像写入mp4但没有任何错误

发布时间:2022-05-10 21:52:27 282
# python

这是我的代码:

`

import glob
import cv2
import numpy as np

vid_testing_paths = 'PathToImages/*.png'

vid_imgs = []
for file in glob.glob(vid_testing_paths):
    y = file
    vid_imgs.append(y)

fps = 60
resolution = (1952, 960)

video = cv2.VideoWriter("PathToVideo/Vid_Name.mp4", 
                        cv2.VideoWriter_fourcc(*"MPEG"), fps, resolution)


x = 1
for v in vid_imgs:
    curr_v = cv2.VideoCapture(v)
    while curr_v.isOpened():
        r, frame = curr_v.read()    # Get return value and curr frame of curr video
        if not r: # r is a boolean # frame is the image array
            break
        video.write(frame)          # Write the frame
         print(x)
         x+=1

video.release()

它卡在第 2030 帧,我有大约 7000 帧我想知道它是否太大而无法放入视频中,因为图像是 9.5 gig(总共)

我也在python -m trace --trace "my_notebooks_name.ipynb"命令提示符下运行它说

"execution_count":null, null 未定义

编辑:我还检查了相应的图像(2030 和 2031),它们看起来很好。我真的不知道问题是什么,任何帮助将不胜感激,谢谢!

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像