Hello,
I set up the following pipeline in gstreamer:
nvarguscamerasrc sensor_id=0 !
video/x-raw(memory:NVMM), width=3264, height=1848, framerate=10/1 !
nvvidconv output-buffers=1 !
video/x-raw, format=NV12 !
appsink max-buffers=1 drop=true name=appsink emit-signals=True
When I read the buffer from appsink I get an array with 9047808 bytes
sample = sink.emit(‘pull-sample’)
Get the actual data
buffer = sample.get_buffer()
Get read access to the buffer data
success, map_info = buffer.map(Gst.MapFlags.READ)
len(map_info.data)
9047808
From my research I was led to believe that the buffer should be 6036984 bytes according to the following calculation:
y = 3264 * 1848 //width * height
CbCr = (1848//2 + 3264//2)*2 // two bytes per every four pixels
y + CbCr
6036984
RGB
self.image = np.ndarray(
shape=(height, width, 3),
dtype=np.uint8,
buffer=map_info.data)
NV12
self.image = {}
self.image[‘Y’] = np.ndarray(
shape=(height, width),
dtype=np.uint8,
buffer=map_info.data[0:heightwidth])
self.image[‘CbCr’] = np.ndarray(
shape=(height//2, width//2, 2),
dtype=np.uint8,
buffer=map_info.data[heightwidth:])
The output image look almost normal, am I missing something?

