Getting frame at its original resolution after nvstreamdemux

Consider the pipeline attached in pdf. As you can see, there are:
GstNvStreamMux --> GstNvInferServer --> ... --> GstNvStreamDemux --> N x Gstnvvideoconvert --> N x GstCapsFilter
pipeline.pdf (65.5 KB)
Since the frame resolution set for GstNvStreamMux is 1920x1080 pixels, when retrieving the individual frames from the GstNvStreamDemux the frame will have a resolution of 1920x1080 pixels. This makes sense as the documentation explicitly mention that GstNvStreamDemux does not scale the content to the original frame resolution.
But is there a way to obtain the frames at the original resolution after the GstNvStreamDemux element?
One idea could be to resize the frames to the original resolution, but that could lead to a loss of quality if the original resolution was higher than the resolution used for scaling by GstNvStreamMux.

Note: right now I am getting the numpy image within a probe attached to the source pad of GstCapsFilter (at the end of the pipeline) using pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id). I do this every time an object is detected because I need to save its image.

Note: I know that the input video stream in the specific attached pipeline have a resolution of 1920x1080, but that might not always be the case. Consider a generic case where the input could be video streams of different resolutions (e.g. 4k, 1080p, 720p) and after the pipeline we want to retrieve the frame at the original resolution.

Thank you!

Why you have this requirement? Is there any real use case do need the feature?

I need to store images of the detected objects. I’d like to store the detection with the highest possible resolution.