H264 encoding using Tegra Multimedia API

Hi,

I am trying to encode frames using Tegra Multimedia API. I am following the example code of “01_video_encode”. But I am stuck in the following call

// Set encoder output plane format
ret = ctx.enc->setOutputPlaneFormat(V4L2_PIX_FMT_YUV420M, ctx.width, ctx.height);

my ctx.width = 1280 and ctx.height = 720 and I am using ctx.encoder_pixfmt = V4L2_PIX_FMT_H264.

The error that I am receiving is

[ERROR] …/tegra_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp:370) <����> :Error in VIDIOC_S_FMT: Inappropriate ioctl for device

FYI, using the same API and following the example code of the decoder “00_video_decoder” I already have implemented a H264 decoder successfully.

So, I don’t understand why for the same device it would through an exception for inappropriate ioctl.

Anybody can suggests anything?

Thanks in advance.

I solved the issue. I had to rebuild and the problem is gone.

Hi,

As I now have the encoded bitstream, my next step is to store it in mp4 file. I suppose this can be done using gstreamer. I could use ffmpeg but unfortunately ffmpeg is not supported on TX2. Can somebody direct me to some example code?

Thanks,

Never mind.

I have done using ffmpeg. Only using the muxer… working without any issues.