How to compress the size of a streaming image

Because the business needs to be decoupled, I have to isolate the flow and detection here, so I can’t use the nvinfer component. I don’t need to process the monitoring image of each frame, I just need to extract the key frames. I tried uridecodebin->streammux->queue- >nvvideoconvert->nvjpegenc ->fakesink In this pipeline, the image is indeed compressed at the source of the stream, which is good, but later I found that there were many damaged images, so I referred to this post and yours The pipeline structure mentioned before uses nvstreamdemux, but the current status is that the stream is blocked