Arvind
Arvind

Reputation: 1

SDI output with PAL mode using Gstreamer and decklink studio 4K card with Opencv

I am trying to stream video over SDI with PAL mode on decklink studio 4K card.

This is working fine I am able to stream the videotestsource

GST_DEBUG=3 gst-launch-1.0 videotestsrc ! video/x-raw,format=BGR,width=720,height=576,framerate=25/1 ! videoconvert ! video/x-raw,format=UYVY,width=720,height=576,framerate=25/1,pixel-aspect-ratio=12/11,interlace-mode=interleaved,colorimetry=bt601,chroma-site=mpeg2 ! decklinkvideosink mode=pal device-number=0

Now I am using this code with GST_DEBUG=3 python3 stream_SDI.py

import cv2

cap = cv2.VideoCapture("output_main.mp4")

gst_pipe = "appsrc ! video/x-raw,format=BGR,width=720,height=576,framerate=25/1 ! videoconvert ! video/x-raw,format=UYVY,width=720,height=576,framerate=25/1,pixel-aspect-ratio=12/11,interlace-mode=interleaved,colorimetry=bt601,chroma-site=mpeg2 ! decklinkvideosink mode=pal device-number=0"

out = cv2.VideoWriter(gst_pipe, cv2.CAP_GSTREAMER, 0, 25.0, (720,576), True)

if not out.isOpened():
    print("coud not open out")
    cap.release()
    exit()

while True:
    ret, frame = cap.read()
    if not ret:
        break
    
    print(frame.shape)

    out.write(frame)

    cv2.imshow("F", frame)

    key = cv2.waitKey(40)
    if key == ord('q'):
        break

out.release()
cap.release()

But getting this error

0:00:00.031007288  8176     0x39964aa0 ERROR           videoconvert gstvideoconvert.c:490:gst_video_convert_set_info:<videoconvert0> input and output formats do not match
0:00:00.031014444  8176     0x39964aa0 WARN           basetransform gstbasetransform.c:1370:gst_base_transform_setcaps:<videoconvert0> FAILED to configure incaps video/x-raw, format=(string)BGR, width=(int)720, height=(int)576, framerate=(fraction)25/1 and outcaps video/x-raw, width=(int)720, height=(int)576, framerate=(fraction)25/1, format=(string)UYVY, pixel-aspect-ratio=(fraction)12/11, interlace-mode=(string)interleaved, colorimetry=(string)bt601, chroma-site=(string)mpeg2
(576, 720, 3)
[ WARN:[email protected]] global cap_gstreamer.cpp:2839 handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module appsrc0 reported: Internal data stream error.
[ WARN:[email protected]] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline
(576, 720, 3)
[ WARN:[email protected]] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline
(576, 720, 3)
[ WARN:[email protected]] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline

When I try 720p50 mode it's working but skipping frames and also I have to compulsary use PAL.

Upvotes: 0

Views: 20

Answers (0)

Related Questions