Thanks for your answer, VPx output really looks like provided format description, I will try to parse it (btw not only VP9, but VP8 too).
As for the lossless, I tried to run H.264 encoder on completely random input (just to test it lossless-ness in the worst case), and I encountered following error:
Opening in O_NONBLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 244, Level = 0
tvmrVideoEncoderBitsAvailable_MSENC: ucode ERROR = 96
NvVideoEncTransferOutputBufferToBlock: DoWork failed line# 650
NvVideoEnc: NvVideoEncTransferOutputBufferToBlock TransferBufferToBlock failed Line=661
My code uses the following codec settings:
m_encoder->setCapturePlaneFormat(V4L2_PIX_FMT_H264, 1024, 1024, 64 * 1024 * 1024);
m_encoder->setOutputPlaneFormat(V4L2_PIX_FMT_YUV444M, m_width, m_height);
m_encoder->setProfile(V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE);
m_encoder->setBitrate(80 * 1024 * 1024);
m_encoder->setMaxPerfMode(1);
m_encoder->setHWPresetType(V4L2_ENC_HW_PRESET_ULTRAFAST);
m_encoder->setConstantQp(0);
m_encoder->output_plane.setupPlane(V4L2_MEMORY_MMAP, 20, true, false);
m_encoder->capture_plane.setupPlane(V4L2_MEMORY_MMAP, 20, true, false);
Don’t mind the insane bitrates and buffer sizes, it fails even without them. They are set just to ensure that codec has sufficient space to write output into. All setup functions are checked so they don’t return -1 or anything below zero, but in this snippet these checks are omitted for simplicity.
This code runs fine for “normal” video streams, and it runs fine for random stream without HIGH_444_PREDICTIVE profile. It even runs fine for random streams with values from range 0…79 instead of 0…255. But it fails on pseudorandom data, even on low resolutions like 256x256. I’m wondering what does this error mean, and the fact itself that codec can fail in arbitrary cases isn’t good, since after that encoding stops completely without any errors returned from userland functions. It just stucks in dequeuing output plane buffer, getting EAGAIN and EAGAIN and EAGA… in endless loop.