H264 encoding and decoding on Jetson


I want to write an encoder and decoder C (C++) solution for jetson structured as:

  1. encoder_init() / decoder_init() function that initializes everything needed for HW encoder/decoder to work on a buffer
  2. encode() / decode() functions that would take a buffer to be encoded/decoded (and probably size of that buffer). This function would be used every time a camera captures a frame
  3. destroy() function that would deallocate memory and/or destroy devices used.

There are sample programs in jetsons multimedia API that take raw yuv or h264 files as an input and use queues and threads so that the video frames could be loaded and encoded/decoded more efficiently… I do not need that at all…

I just need to prepare an encoder/decoder so that I could provide it with a “buffer” to be encoded/decoded.

I guess my question is how do i reconstruct that code for my purposes!
Here is that code

We have discussion in this post:
Jetson Multimedia API in C

For optimal solution, it is to use V4L2_MEMORY_DMABUF so that you can use NvBuffer to achieve zero copy. If you would like to get rid of this structure, you can try V4L2_MEMORY_MMAP. But please note the performance may not be optimal.

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