Jpeg encodeFromFd makes corrupted frame

I’m making application that will stream jpeg images. It works fine on TX2 but on Xavier AGX I getting corrupted frames. Looks like jpeg size is broken or jpeg encoder didn’t complete the frame. I made small example that demonstrate the issue: it makes frames with random lines, converts yuv422 to yuv420, encodes it to jpeg, sends over HTTP and saving to local file. In browser you will see that image height changes. In saved files you will see that jpeg-s are broken:
res160
res161
res165

I’m using JP 4.6.1 and L4T 32.7.1

To reproduce the issue:
run ./main_http_jpg --port 5555 --max_size 640 --quality 75
main_http_jpg.cpp (5.0 KB)
and open test.html in browser on the xavier
test.html (1.4 KB)

Not sure, but what gives ? :

ldd ./main_http_jpg

Hi,
Please try to reproduce the issue with our demo sample:

/usr/src/jetson_multimedia_api/samples/05_jpeg_encode

See if the issue is also present by running the sample.

linux-vdso.so.1 (0x0000ffffbacda000)
libpthread.so.0 => /lib/aarch64-linux-gnu/libpthread.so.0 (0x0000ffffbac6b000)
libboost_system.so.1.71.0 => /usr/lib/aarch64-linux-gnu/libboost_system.so.1.71.0 (0x0000ffffbac59000)
libboost_program_options.so.1.71.0 => /usr/lib/aarch64-linux-gnu/libboost_program_options.so.1.71.0 (0x0000ffffbabc5000)
libboost_filesystem.so.1.71.0 => /usr/lib/aarch64-linux-gnu/libboost_filesystem.so.1.71.0 (0x0000ffffbab9b000)
libv4l2.so.0 => /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0 (0x0000ffffbaa85000)
libnvbuf_utils.so.1.0.0 => /usr/lib/aarch64-linux-gnu/tegra/libnvbuf_utils.so.1.0.0 (0x0000ffffbaa6a000)
libnvjpeg.so => /usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so (0x0000ffffbaa10000)
libevent-2.1.so.7 => /usr/lib/aarch64-linux-gnu/libevent-2.1.so.7 (0x0000ffffba9ac000)
libstdc++.so.6 => /usr/lib/aarch64-linux-gnu/libstdc++.so.6 (0x0000ffffba7c7000)
libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffba71c000)
libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffba6f8000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffba585000)
/lib/ld-linux-aarch64.so.1 (0x0000ffffbacaa000)
libv4lconvert.so.0 => /usr/lib/aarch64-linux-gnu/libv4lconvert.so.0 (0x0000ffffba4ff000)
libdl.so.2 => /lib/aarch64-linux-gnu/libdl.so.2 (0x0000ffffba4eb000)
libnvrm_host1x.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_host1x.so (0x0000ffffba4ca000)
libnvrm_mem.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_mem.so (0x0000ffffba4b2000)
libnvrm_surface.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_surface.so (0x0000ffffba47c000)
libEGL.so.1 => /usr/lib/aarch64-linux-gnu/libEGL.so.1 (0x0000ffffba458000)
libnvddk_vic.so => /usr/lib/aarch64-linux-gnu/tegra/libnvddk_vic.so (0x0000ffffba43b000)
libnvbuf_fdmap.so.1.0.0 => /usr/lib/aarch64-linux-gnu/tegra/libnvbuf_fdmap.so.1.0.0 (0x0000ffffba428000)
libnvddk_2d_v2.so => /usr/lib/aarch64-linux-gnu/tegra/libnvddk_2d_v2.so (0x0000ffffba404000)
libnvvic.so => /usr/lib/aarch64-linux-gnu/tegra/libnvvic.so (0x0000ffffba3db000)
libnvbufsurface.so.1.0.0 => /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurface.so.1.0.0 (0x0000ffffba323000)
libnvmedia.so => /usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so (0x0000ffffba2ab000)
librt.so.1 => /lib/aarch64-linux-gnu/librt.so.1 (0x0000ffffba293000)
libnvrm_chip.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_chip.so (0x0000ffffba27f000)
libnvos.so => /usr/lib/aarch64-linux-gnu/tegra/libnvos.so (0x0000ffffba25f000)
libnvsciipc.so => /usr/lib/aarch64-linux-gnu/tegra/libnvsciipc.so (0x0000ffffba23a000)
libnvsocsys.so => /usr/lib/aarch64-linux-gnu/tegra/libnvsocsys.so (0x0000ffffba226000)
libnvrm_sync.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_sync.so (0x0000ffffba20f000)
libGLdispatch.so.0 => /usr/lib/aarch64-linux-gnu/libGLdispatch.so.0 (0x0000ffffba084000)
libnvrm_stream.so => /usr/lib/aarch64-linux-gnu/tegra/libnvrm_stream.so (0x0000ffffba06b000)
libnvcolorutil.so => /usr/lib/aarch64-linux-gnu/tegra/libnvcolorutil.so (0x0000ffffba044000)
libnvvideo.so => /usr/lib/aarch64-linux-gnu/tegra/libnvvideo.so (0x0000ffffb9f65000)
libnvtvmr.so => /usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so (0x0000ffffb9e6e000)
libnvdc.so => /usr/lib/aarch64-linux-gnu/tegra/libnvdc.so (0x0000ffffb9e4e000)
libnvparser.so => /usr/lib/aarch64-linux-gnu/tegra/libnvparser.so (0x0000ffffb9e02000)
libnvimp.so => /usr/lib/aarch64-linux-gnu/tegra/libnvimp.so (0x0000ffffb9ded000)

I tried to reproduce with 05_jpeg_encode, but it compress only one frame per run and issue doesn’t happen.

hi,
The NvJpegEncoder is implemented for single JPEG encoding. Please refer to discussion in
JPEG encoding is not continuous

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