GStreamer stops unexpectedly after getting H.264 for about 7 minutes

Thank you for the helpful information.

I investigated the memory usage. And I think it’s very possible that it’s a memory leak.
It seems that memory growth cannot be avoided as long as the nvv4l2h264enc is used.

I think the only workaround is to use omxh264enc even though it is deprecated.

I really hope that it will be improved in future releases.


Investigation

Measure memory usage while running the GStreamer for 10 minutes with following command:

gst-launch-1.0 -v videotestsrc is-live=true ! video/x-raw,width=1920,height=1080,framerate=15/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvv4l2h264enc iframeinterval=15 bitrate=${bitrate} bit-packetization=true slice-header-spacing=${size} insert-sps-pps=true insert-vui=true ! video/x-h264,stream-format=byte-stream ! fakesink

Patterns:

  • bitrate=3000000
    • slice-header-spacing=1024
    • slice-header-spacing=4096
    • slice-header-spacing=8192
    • slice-header-spacing=16384
  • bitrate=6000000
    • slice-header-spacing=1024
    • slice-header-spacing=4096
    • slice-header-spacing=8192
    • slice-header-spacing=16384

Measure memory usage:

$ tegrastats 
RAM 627/7858MB (lfb 1466x4MB) SWAP 28/3929MB (cached 0MB) CPU [1%@345,off,off,0%@345,0%@345,0%@345] EMC_FREQ 0% GR3D_FREQ 0% PLL@38C MCPU@38C PMIC@50C Tboard@37C GPU@36.5C BCPU@38C thermal@37.7C Tdiode@36.5C
RAM 627/7858MB (lfb 1466x4MB) SWAP 28/3929MB (cached 0MB) CPU [1%@345,off,off,0%@345,0%@345,0%@345] EMC_FREQ 0% GR3D_FREQ 0% PLL@38C MCPU@38C PMIC@50C Tboard@37C GPU@36.5C BCPU@38C thermal@37.4C Tdiode@36.75C
RAM 700/7858MB (lfb 1466x4MB) SWAP 28/3929MB (cached 0MB) CPU [13%@2035,off,off,7%@2035,6%@2035,14%@2035] EMC_FREQ 0% GR3D_FREQ 0% PLL@39C MCPU@39C PMIC@50C Tboard@37C GPU@36.5C BCPU@39C thermal@37.4C Tdiode@36.75C
    ~~~
      ^-- measure this

Results of bitrate=3000000

nvv4l2_bitrate-3000000

Results of bitrate=6000000

nvv4l2_bitrate-6000000

Results of omxh264enc bitrate=3000000

Command:

gst-launch-1.0 -v videotestsrc is-live=true ! video/x-raw,width=1920,height=1080,framerate=15/1 ! omxh264enc iframeinterval=15 bitrate=3000000 bit-packetization=true slice-header-spacing=${size} insert-sps-pps=true insert-vui=true ! video/x-h264,stream-format=byte-stream ! fakesink

omx_bitrate-3000000