Dropped/Corrupted Frames During Gstreamer Recording

I am occasionally getting dropped/corrupted frames during recordings using my Gstreamer pipeline. It occurs intermittently and seems random. At first I thought it might be occurring during periods of high motion, but in the attached image the camera is just pointing at a picture on a wall, i.e. the image is static. The gray frames persist for ~5-10 frames and then recover.

My pipeline is:

interpipesrc name=intersrc%d listen-to=src_2 ! nvv4l2h265enc bitrate=6200000 peak-bitrate=9300000 control-rate=0 profile=0 preset-level=1 iframeinterval=40 maxperf-enable=true qp-range=27,50:27,50:-1,-1 vbv-size=103333 ! h265parse ! matroskamux ! filesink async=false sync=false location=/test.mkv -e

Video frame size/rate is 720p@120fps, and I set vbv-size to 2*bitrate/fps. I also saw this problem when vbv-size was default (4000000).

I’m wondering if anyone can suggest tweaks to my pipeline in order to fix these?

hello xela,

may I know which Jetpack release version you’re now working with?
had you configure the system to performance mode, i.e. MaxN? had you also tried h264?

Hi @JerryChang:

I am using JetPack 32.7.2.

System performance mode is configured to MaxN.

I have tried h264 before but was able to get a better balance of video quality and file size for my application using h265.

hello xela,

did you meant you’ve also seen this issue with h264?

@JerryChang I can’t recall if I ever saw the gray screen issue with h264, it has been a bit since I last tried that encoder. However, today I did prepare a new pipeline using a h264 with CBR, and also changed the profile to main and the preset-level to 2. This seems to do well in an office environment, but I will test it tomorrow in the field.

Either way, I would still like to understand why I am seeing the issue with the h265 encoder. Is it a likely issue with the encoder itself, or just my settings (e.g. VBR vs CBR, profile, preset-level, etc)?

hello xela,

you may also narrow down the issue to store the content locally for confirmation.
here’s example to preview stream and doing h265 video recording.
$ gst-launch-1.0 nvarguscamerasrc num-buffers=300 ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! tee name=streams streams. ! queue ! nvv4l2h265enc bitrate=8000000 ! h265parse ! qtmux ! filesink location=h265.mp4 streams. ! queue ! nvvidconv ! xvimagesink -e

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.