I am currently working on a project involving recording from an HDMI v4l2 capture device using a Jetson Xavier NX on a custom carrier board. When the video source is set to 1280x720@60Hz, I use the following pipeline to capture:
gst-launch-1.0 nvv4l2camerasrc device=“/dev/video8” ! ‘video/x-raw(memory:NVMM), width=1280, height=720, format=UYVY, framerate=60/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=60/1’ ! nvv4l2h264enc control-rate=0 ! ‘video/x-h264, stream-format=(string)byte-stream’ ! h264parse ! avimux ! filesink location=/remote/Videos/gstlaunch.avi
/remote is an NFS share and the device is /dev/video8 because there is an 8-channel SD capture device (currently unused).
For 1920x1080 capture, I use:
gst-launch-1.0 nvv4l2camerasrc device=“/dev/video8” ! ‘video/x-raw(memory:NVMM), width=1920, height=1080, format=UYVY, framerate=30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=30/1’ ! nvv4l2h264enc control-rate=0 ! ‘video/x-h264, stream-format=(string)byte-stream’ ! h264parse ! avimux ! filesink location=/remote/Videos/gstlaunch.avi
I am finding that when encoding, I lose approximately 38 frames out of every 5000 for 1080p30 and 114 frames out of every 5000 for 720p60. Frame drops at 1920x1080 seem to be singular, whereas at 1280x720, they seem to happen in groups of 7-8.
I am using a signal generator that embeds a timestamp in each frame so that I can detect gaps between frames at the recording and capture levels. I have confirmed that there are no gaps when capturing directly to memory from video4linux, so it looks as if the H.264 encoder is doing this.
I have seem similar behaviour with the omxh264enc plugin as well as nvv4l2h265enc. I have also noticed that when using a transport stream or Matroska mux instead of AVI, it will inject duplicate frames to make up for the dropped ones.
I would be grateful for any suggestions about how to eliminate frame drops.