Yes thats right. Just add an encoder before the SR bin. I also do it this way - I have a requirement to see all the metadata on the frames so I want to add SR after inference (and after stream demuxing); so I have a pipeline like this:
rtsp (or anything that works with a decodebin) ! decodebin ! streammux ! nvinfer ! tracker ! nvdsanalytics ! streamdemux ! queue ! nvvideoconvert ! “video/x-raw(memory:NVMM), format=I420” ! nvv4l2h265enc ! h265parse ! SR tee ! queue ! fakesink
Now, see the “SR tee” element. Just link the SR bin to that.
It seems to work really well and I see no performance issues whatsoever re-encoding (probably because its all done in hardware).
ps. I could also tap off the SR bin before decoding my rtsp sources and have some other magical setup to post-process the saved videos to draw the metadata onto them… but thats seems much more hard work than just re-encoding for me… ;-)