Issue with Encoder Performance: Low MSENC frequency with NVMM memory input in GStreamer

I’m trying to do simultaneous encoding of three streams on my TX2. It seems that when I use NVMM memory as input to the omxh264enc encoder it does not correctly set the MSENC frequency to be high enough (115 vs 1113) to maintain encoding performance (17fps instead of 30fps). The only difference between the pipelines is a missing (memory:NVMM) on the high perf one.

Can someone try and confirm this issue? I’m unsure if it is an issue with just my TX2 or not…

Low performance pipeline:

gst-launch-1.0 -v -e matroskamux name="muxer" streamable=true ! fakesink \
  videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! muxer.video_0 \
  videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! muxer.video_1 \
  videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! fpsdisplaysink video-sink=fakesink text-overlay=false

GstFPSDisplaySink output:

GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 15424, dropped: 0, current: 16.96, average: 17.69

tegrastats output:

RAM 2391/7854MB (lfb 911x4MB) CPU [39%@345,off,off,47%@345,34%@346,29%@345] EMC_FREQ 3%@1600 GR3D_FREQ 3%@140 MSENC 115 APE 150 BCPU@41.5C MCPU@41.5C GPU@39.5C PLL@41.5C Tboard@37C Tdiode@38C PMIC@100C thermal@40.7C VDD_IN 4419/6325 VDD_CPU 230/662 VDD_GPU 153/153 VDD_SOC 1383/2066 VDD_WIFI 672/597 VDD_DDR 980/1682

High performance pipeline:

gst-launch-1.0 -v -e matroskamux name="muxer" streamable=true ! fakesink \
  videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! muxer.video_0 \
  videotestsrc ! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! muxer.video_1 \
  videotestsrc ! nvvidconv ! 'video/x-raw, format=(string)I420,width=(int)1920, height=(int)1080' \
  ! omxh264enc bitrate=10000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! fpsdisplaysink video-sink=fakesink text-overlay=false

GstFPSDisplaySink output:

GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 1386, dropped: 0, current: 29.83, average: 30.04

tegrastats output:

RAM 2419/7854MB (lfb 911x4MB) CPU [62%@1420,off,off,55%@1420,52%@1421,64%@1420] EMC_FREQ 33%@1600 GR3D_FREQ 2%@140 MSENC 1113 APE 150 BCPU@43C MCPU@43C GPU@40.5C PLL@43C Tboard@37C Tdiode@39.25C PMIC@100C thermal@42.3C VDD_IN 8294/8334 VDD_CPU 1151/1131 VDD_GPU 153/153 VDD_SOC 2763/2738 VDD_WIFI 499/600 VDD_DDR 2323/2311

Platform Info:
TX2 L4T Version:

# R28 (release), REVISION: 2.1, GCID: 11272647, BOARD: t186ref, EABI: aarch64, DATE: Thu May 17 07:29:06 UTC 2018

Hi,
Please try https://devtalk.nvidia.com/default/topic/1032771/jetson-tx2/no-encoder-perfomance-improvement-before-after-jetson_clocks-sh/post/5255605/#5255605