If I understand correctly you have an rtsp stream which uses tcp. You are unpacking the stream and just extracting the raw nal units then repackaging them and sending them via raw udp without a communication protocol and hoping VideoCapture will know how to read and decode them. Is that correct?
Can VLC or FFmpeg read the raw UDP stream from the localhost url? If your only requirement is udp why can’t you stream from the ip camera via udp directly, I’m pretty sure that would be the default transport protocol?