Jetson_multimedia_api 05_jpeg_encode

I use jetson_multimedia_api samples 05_jpeg_encode to encode NV12 picture. I use command ./jpeg_encode /home/cookoo/yuv2jpg/1.yuv 1280 960 /home/cookoo/yuv2jpg/1_100.jpg -f 2 -quality 100. I can get .jpg picture, but the color is not correct. Can anyone help? Thanks.
1.yuv (1.8 MB)

We can observe the issue and will check further. You may encode YUV420 to get valid JPEG.

Thanks for the quick response. Please let me know once your team solve this issue.

We have confirmed it supports YUV420 by default. For NV12 input, please apply the change to jpeg_encode_proc():

  1. Modify format in the line to NVBUF_COLOR_FORMAT_NV12
    params.colorFormat = NVBUF_COLOR_FORMAT_YUV420;
  1. NV12 has two planes, so remove the line of reading 3rd plane:
    read_dmabuf(src_dma_fd, 0, ctx.in_file);
    read_dmabuf(src_dma_fd, 1, ctx.in_file);
    read_dmabuf(src_dma_fd, 2, ctx.in_file); // remove this line

Please apply the change and try again.

1 Like

Thanks DaneLLL, your solution works!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.