You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用OpenCV+GStreamer结合Decklink Studio 4K卡以PAL模式输出SDI视频失败的问题求助

各位好,我现在尝试用Decklink Studio 4K卡以PAL模式通过SDI输出视频,直接用GStreamer命令推流测试源是完全正常的:

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

但换成Python+OpenCV的代码(运行命令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()

得到的错误日志如下:

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:0@0.143] global cap_gstreamer.cpp:2839 handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module appsrc0 reported: Internal data stream error.
[ WARN:0@0.145] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline
(576, 720, 3)
[ WARN:0@0.188] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline
(576, 720, 3)
[ WARN:0@0.232] global cap_gstreamer.cpp:2730 writeFrame OpenCV | GStreamer warning: Error pushing buffer to GStreamer pipeline

另外我尝试切换到720p50模式是可以工作的,但会出现跳帧情况,而且我的需求里必须使用PAL模式,有没有大佬能帮忙分析下问题出在哪,怎么解决呢?

备注:内容来源于stack exchange,提问作者Arvind

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 03:20:10