How does slice mode video encoding work for Jetson?

Hi,

I have a question about video encoding using slice mode. In my application, I want to split an image into 4 slices.
I have the following questions:

  1. How can I know how many macroblocks exist in a single frame? Since I want to split a frame into 4 slices, if I use the V4L2_ENC_SLICE_LENGTH_TYPE_MBLK type, I need to set a slice length equals to the total number of macroblocks divided by 4. So how can I know the total amount of macroblock?

  2. I’m wondering how this slice-mode works. If I split an image into 4 slices, will the encoder_capture_plane_dp_callback get called 4 times per frame, or it will still be called one time but have 4 NAL unit inside the encoded frame buffer.

Thanks.

Hi, we don’t support interlace encoding. Inputs have to be progressive frames.

Hi DaneLLL,

Yes, my input is a progressive frame, but since I’m using slice mode, I should be able to get multiple encoded slices of this frame right? My goal is to insert a progressive frame into the encoder, and get four slices of the encoded frame out of the encoder. So with this context, could you answer my questions?

  1. How can I know how many macroblocks exist in a single frame? Since I want to split a frame into 4 slices, if I use the V4L2_ENC_SLICE_LENGTH_TYPE_MBLK type, I need to set a slice length equals to the total number of macroblocks divided by 4. So how can I know the total amount of macroblock?

  2. I’m wondering how this slice-mode works. If I split an image into 4 slices, will the encoder_capture_plane_dp_callback get called 4 times per frame, or it will still be called one time but have 4 NAL unit inside the encoded frame buffer.

Thanks.

Hi, what is your input resolution?

We need to further check if we support this mode. Need to know the input resolution.

I have two setups. One with 640x480, another one with 1280x720 resolution.

Please provide more detail of how this slice-mode work. There is little information about it. Thanks.

Any update about this?

Hi, we are checking if we support it. Do you run h264 encoding?

Yes. H264.

Any update please?

We’re checking. You may contact your region salesperson to evaluate/raise the priority. Thanks.

Several weeks passed. Any updates?

Looks like we don’t support this mode. What is your usecase?

Can you let me know what does slice mode mean? You have the slice mode parameter in the API.

My usecase is to do some parallel process.

Hi juliawzc,
The mecroblock number is

macroblocks = WIDTH_ALIGN_TO_16*HEIGHT_ALIGN_TO_16/256

For 640x480, there are 1200 macroblocks and you can have 4 slices by setting

m_VideoEncoder->setSliceLength(V4L2_ENC_SLICE_LENGTH_TYPE_MBLK, 300);

We don’t support the mode encoder_capture_plane_dp_callback is called per slice. It is called per a complete frame.