python视频b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00\x00\x00\

2024-05-16 05:57:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我从websockets收到此视频流 b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00\x00\x00。。。。 我把这个链表保存到文件中

Blockquote

frame = await websocket.recv()
dataImg64 = str(frame)
with open("from_web.mp4", "wb") as f:
                f.write(stream)
                f.flush()

Blockquote

_web.mp4中的文件包含 b'\x1aE\xdf\xa3\x01\x00\x00\x00\x00\x00\x00\x00\x00

我尝试从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

有什么建议吗? 彼得


Tags: 文件webwebsocketsawaitframewebsocketmp4xdf
2条回答

我重新编写了代码的一部分

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=wait websocket.recv()

with open("from_web.mp4", "wb") as f:
        f.write(frame[0:len(frame)])
        f.flush()

cap=cv2.VideoCapture(“da_email.mp4”)

相关问题 更多 >