Hi @DaneLLL,
Aside from all the other problems, it seems the basic premise of the question did not receive a good answer yet :-(
It seems that buffers I pass to the encoder via GStreamer are not processed correctly. They seem to have some strange mis-interpretation to them, with the lines going all slanty (I’m sorry about the non-technical term).
I’ve recreated the issue for a single frame by using the following gstreamer pipeline, and then analyzing the file as raw yuv:
appsrc name=injector num-buffers=1 ! video/x-raw(memory:NVMM),width=1920,height=1080,framerate=25/1,format=I420 ! nvvidconv ! video/x-raw ! filesink location=/tmp/frame.yuv
I’ve also dumped the buffer to a file using the following commands:
size_t rawSize = inputPicture.size.width*inputPicture.size.height;
void *y, *u, *v;
NvBufferMemMap( outputBuffer.getFd(), 0, NvBufferMem_Read, &y );
NvBufferMemMap( outputBuffer.getFd(), 1, NvBufferMem_Read, &u );
NvBufferMemMap( outputBuffer.getFd(), 2, NvBufferMem_Read, &v );
NvBufferMemSyncForCpu( outputBuffer.getFd(), 0, &y );
NvBufferMemSyncForCpu( outputBuffer.getFd(), 1, &u );
NvBufferMemSyncForCpu( outputBuffer.getFd(), 2, &v );
dumpFd = open("/tmp/input.yuv", O_CREAT|O_TRUNC|O_WRONLY, 0666);
write(dumpFd, y, rawSize);
write(dumpFd, u, rawSize/4);
write(dumpFd, v, rawSize/4);
NvBufferMemUnMap( outputBuffer.getFd(), 0, &y );
NvBufferMemUnMap( outputBuffer.getFd(), 1, &u );
NvBufferMemUnMap( outputBuffer.getFd(), 2, &v );
close(dumpFd);
What I see is that displaying input.yuv
shows a valid 4:2:0 Planar picture at 1920x1080. frame.yuv
, on the other hand, kind of makes sense if you treat it as 1800x1152, except it contains lines that have a smaller stride or 1792, with every 16 lines a line is skipped.
I am attaching both files as PNG (I cannot upload yuv due to permissions on the forum). For frame.yuv it is produced with stride of 1800. You can see that if you zoom out, it is obvious that it is the same picture (including correct colors).
As I said above, I’m showing this using a static picture, but the generated HEVC suffers from a substantially similar problem.
Help?
Thank you,
Shachar