I read the UYVY image from the camera based on 12 examples,Need to save it as multiple jpg files,But a segfault error at output_plane.qBuffer。
The attachment is the source code。
12_camera_v4l2_cuda.zip (12.8 KB)
Hi,
In the sample, you initialize NvVideoConverter. We would suggest use NvBufferTransform() for the conversion, and refer to the code about –encode-fd in 05_jpeg_encode.
I don’t understand why segfault error is caused in my code. Can you please explain the cause of the error?
Is there a convenient conversion function between “NvBuffer” and “v4l2_buffer”, manual assignment is troublesome and error-prone
Hi,
The deviation between your code and default sample is huge and we are not able to completely understand it. Just see you use NvVideoConverter. We encourage users to call the new API NvBufferTransform() instead of using NvVideoConverter. Please try this suggestion.
What I want to do is to save each frame as a jpg file while displaying in real time
Hi,
In default code of 12_camera_v4l2_cuda, it creates YUV420M NvBuffer render_dmabuf_fd for frame rendering. The camera frames are in YUV422 and will be converted to YUV420:
/* Convert the camera buffer from YUV422 to YUV420P */
if (-1 == NvBufferTransform(ctx->g_buff[v4l2_buf.index].dmabuff_fd, ctx->render_dmabuf_fd,
&transParams))
ERROR_RETURN("Failed to convert the buffer");
You can implement the same for jpeg encoding. Create an NvBuffer and encode it via NvJpegEncoder.