Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numpy类型转ExternalVideoFrame类型 #3

Open
flinzhao opened this issue Nov 4, 2024 · 0 comments
Open

numpy类型转ExternalVideoFrame类型 #3

flinzhao opened this issue Nov 4, 2024 · 0 comments

Comments

@flinzhao
Copy link

flinzhao commented Nov 4, 2024

i420_array = cv2.cvtColor(bgr_array, cv2.COLOR_BGR2YUV_I420)

external_video_frame = ExternalVideoFrame()
external_video_frame.type = 1
external_video_frame.format = 1  # 设置为I420格式,对应的值为1
external_video_frame.buffer = bytearray(i420_array.tobytes())
external_video_frame.stride = i420_array.shape[1]
external_video_frame.height = i420_array.shape[0]
sender.send_video_frame(external_frame)  # sender为VideoFrameSender类型

运行发送代码,程序直接奔溃

Segmentation fault (core dumped)

由numpy类型的BGR数组到type值分别为0、1、4的ExternalVideoFrame对象的正确转换方式应该是怎样的?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant