Hi,
I’m learning the source code of the example video_encode from Multimedia API, and found the following statements.
// It is necessary that Capture Plane format be set before Output Plane
// format.
// Set encoder capture plane format. It is necessary to set width and
// height on thr capture plane as well
ret =
ctx.enc->setCapturePlaneFormat(ctx.encoder_pixfmt, ctx.width,
ctx.height, 2 * 1024 * 1024);
TEST_ERROR(ret < 0, "Could not set output plane format", cleanup);
Since this video_encode command line accept the width and height, and usually even 4K YUV Raw video doesn’t generate a 2M packet, here the 2 * 1024 * 1024 is just a assumption right ?
Another question is that does this video_encode example only accept a YUV420 raw video file ? Does it write out the H264 JAL stream from the function ?
static int
write_encoder_output_frame(ofstream * stream, NvBuffer * buffer)
{
stream->write((char *) buffer->planes[0].data, buffer->planes[0].bytesused);
return 0;
}
A bit confused here that the programs set V4L2_PIX_FMT_YUV420M as the output plane, so I assume it means the encoded packet contains the YUV420 pixels.
ret =
ctx.enc->setOutputPlaneFormat(V4L2_PIX_FMT_YUV420M, ctx.width,
ctx.height);
TEST_ERROR(ret < 0, "Could not set output plane format", cleanup);
Sorry just started to use the TX2 board, not sure a lot of details.
Thank you very much.