问题描述
我从 websockets 收到这个视频流 b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00.... 我将流保存到文件
块引用
frame = await websocket.recv()
dataimg64 = str(frame)
with open("from_web.mp4","wb") as f:
f.write(stream)
f.flush()
块引用
文件 from_web.mp4 包含 b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00....
我尝试打开 from_web.mp4 cap = cv2.VideoCapture("da_email.mp4") 但我有错误
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27cd9e0] moov atom not found
VIdioC_REQBUFS: Inappropriate ioctl for device
有什么建议吗? 彼得
解决方法
我重写了部分代码
frame = await websocket.recv()
stream= str(frame)##i made a cast to string,is right?
with open("from_web.mp4","wb") as f:
f.write(stream)
f.flush()
cap = cv2.VideoCapture("da_email.mp4")
,
我有决心,用这部分代码 frame = 等待 websocket.recv()
with open("from_web.mp4","wb") as f:
f.write(frame[0:len(frame)])
f.flush()
cap = cv2.VideoCapture("da_email.mp4")