hello!
I have a script which performs a warp perspective then sends it to an RTMP target with gstreamer, via opencv videowriter
This script works fine when I am loading the image from the harddrive and passing it straight to the video writer, but when I put it through the VPI functions it must become warped - or there is some kind of incompatibility
My gstreamer command for opencv video writer is as follows:
def gstreamer_pipeline_out_2_WORKS():
return (
"appsrc ! "
"queue ! "
"videoconvert ! "
"video/x-raw,format=RGBA ! "
"nvvidconv ! "
"nvv4l2h264enc ! "
"video/x-h264,stream-format=(string)byte-stream,alignment=(string)au ! "
"h264parse ! "
"flvmux name=mux ! "
"rtmpsink location=rtmp://global-live.mux.com:5222/app/[secret key]"
)
out_stream = cv2.VideoWriter(
gstreamer_pipeline_out_2_WORKS(),
cv2.CAP_GSTREAMER, 0, 30.0,
(1500,1500))
This works fine for non VPI images, but the same image passed through the VPI functions and monitored at the RTMP end point is distorted (but definitely there and moving with the perspective homography time-shift) - which looks like a bit-depth problem
my VPI loop is as follows:
cnt = 0
while True:
cnt +=1
hom = np.array([
[1, math.sin(cnt/10), 0],
[0, 1, 0],
[0, 0, 1]])
with vpi.Backend.CUDA:
with streamLeft:
frame1 = vpi.asimage(test_img).convert(vpi.Format.NV12_ER)
with streamRight:
frame2 = vpi.asimage(test_img).convert(vpi.Format.NV12_ER)
with vpi.Backend.CUDA:
with streamLeft:
frame1 = frame1.perspwarp(hom)
with streamRight:
frame2 = frame2.perspwarp(hom)
with vpi.Backend.CUDA:
with streamLeft:
frame1 = frame1.convert(vpi.Format.RGB8)
with streamRight:
frame2 = frame2.convert(vpi.Format.RGB8)
streamLeft.sync()
streamRight.sync()
with frame1.rlock_cpu() as data:
out_stream.write(data)
does anyone have any ideas what could be distorting the image? When I run without the VPI I get this at the RTMP stream monitor, as it should be
thanks for any assistance!