I am seeing unexpected behavior when using the xavier video encoder, for this question I will use the 01_video_encode sample application for testing.
I expect that when I change bitrate/s that the resulting image and file size have changed according to the set bitrate but seems that only the quality has changed. I added a print statement in encoder_capture_plane_dq_callback to print buffer->planes[0].bytesused to highlight this fact.
lets compare to TX2 which I have available
on Xavier-NX (bitrate is 1024 kb):
./video_encode 0_recorded_10000.yuv 1910 1272 H264 encoded_test.yuv -br 1024000
bytes in frame was 9265
bytes in frame was 9006
bytes in frame was 7956
bytes in frame was 7675
bytes in frame was 7358
bytes in frame was 7175
bytes in frame was 7375
bytes in frame was 7580
On other calls with different bitrate the bytesize in this call is always about the same
in Tx2 (bitrate also 1024 kb):
./video_encode 0_recorded_10000.yuv 1910 1272 H264 encoded_test.yuv -br 1024000
bytes in frame was 310
bytes in frame was 310
bytes in frame was 303
bytes in frame was 302
bytes in frame was 296
bytes in frame was 297
bytes in frame was 296
bytes in frame was 300
bytes in frame was 324
bytes in frame was 309
bytes in frame was 302
bytes in frame was 298
bytes in frame was 295
bytes in frame was 301
bytes in frame was 299
In other calls with changing bitrate the values here seem to change as predicted…
Not sure why this is occurring, do not see anything in the documentation to explain this, on Xavier am using l4t 35.5.0, on Tx2 using l4t 32.4.4
Hi,
The issue is specific to the resolution 1910x2172. We will check further. In the meantime, please try standard resolution like 1920x1080 and 1280x720.
And please share a valid YUV file in 1910x2172. We are not able to generate a valid file by running gst-launch-1.0 command like:
Discovered the issue was due to NvBuffer::NvBufferPlaneFormat::bytesperpixel field being overwritten during our conversion step, fixed this and the encoding is working as expected.
Ok, I see that --sp (semiplanar) option needs to be set in order for this sample to set to raw pixel format NV12 mode in encoder (otherwise it is YUV420) and output seems correct now, but why is this required?