我有一个简单的程序,试图将视频从相机中取出并通过omxh264enc
运行。元素链接如下所示:
gst_element_link (source, cFilter0);
gst_element_link (cFilter0, encoder);
gst_element_link (encoder, cFilter1);
gst_element_link (cFilter1, autovs);
但是我得到如下所示的错误:
Framerate set to : 30 at NvxVideoEncoderSetParameter0:00:00.609624260 3087 0x683850 ERROR omxh264enc gstomxh264enc.c:280:gst_omx_h264_enc_set_format:<264encoder> Empty caps
0:00:00.609644260 3087 0x683850 ERROR omxvideoenc gstomxvideoenc.c:1815:gst_omx_video_enc_set_format:<264encoder> Subclass failed to set the new format
0:00:00.609656996 3087 0x683850 WARN videoencoder gstvideoencoder.c:623:gst_video_encoder_setcaps:<264encoder> rejected caps video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1
0:00:00.609696708 3087 0x683850 INFO basesrc gstbasesrc.c:2843:gst_base_src_loop:<camerasrc> marking pending DISCONT
0:00:00.609804004 3087 0x683850 FIXME videoencoder gstvideoencoder.c:606:gst_video_encoder_setcaps:<264encoder> GstVideoEncoder::reset() is deprecated
Framerate set to : 30 at NvxVideoEncoderSetParameter0:00:00.609876579 3087 0x683850 ERROR omxh264enc gstomxh264enc.c:280:gst_omx_h264_enc_set_format:<264encoder> Empty caps
0:00:00.609890819 3087 0x683850 ERROR omxvideoenc gstomxvideoenc.c:1815:gst_omx_video_enc_set_format:<264encoder> Subclass failed to set the new format
0:00:00.609903779 3087 0x683850 WARN videoencoder gstvideoencoder.c:623:gst_video_encoder_setcaps:<264encoder> rejected caps video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1
0:00:00.609955843 3087 0x683850 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<camerasrc> error: Internal data flow error.
0:00:00.609971683 3087 0x683850 WARN basesrc gstbasesrc.c:2948:gst_base_src_loop:<camerasrc> error: streaming task paused, reason not-negotiated (-4)
0:00:00.610001219 3087 0x683850 INFO GST_ERROR_SYSTEM gstelement.c:1879:gst_element_message_full:<camerasrc> posting message: Internal data flow error.
0:00:00.610046498 3087 0x683850 INFO GST_ERROR_SYSTEM gstelement.c:1902:gst_element_message_full:<camerasrc> posted error message: Internal data flow error.
0:00:00.610141602 3087 0x683850 FIXME videoencoder gstvideoencoder.c:606:gst_video_encoder_setcaps:<264encoder> GstVideoEncoder::reset() is deprecated
0:00:00.610159906 3087 0x683850 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 0 was not flushing
0:00:00.610175682 3087 0x683850 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 1 was not flushing
Framerate set to : 30 at NvxVideoEncoderSetParameter0:00:00.610238113 3087 0x683850 ERROR omxh264enc gstomxh264enc.c:280:gst_omx_h264_enc_set_format:<264encoder> Empty caps
0:00:00.610250977 3087 0x683850 ERROR omxvideoenc gstomxvideoenc.c:1815:gst_omx_video_enc_set_format:<264encoder> Subclass failed to set the new format
0:00:00.610262593 3087 0x683850 WARN videoencoder gstvideoencoder.c:623:gst_video_encoder_setcaps:<264encoder> rejected caps video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1
0:00:00.610340385 3087 0x683850 FIXME videoencoder gstvideoencoder.c:606:gst_video_encoder_setcaps:<264encoder> GstVideoEncoder::reset() is deprecated
0:00:00.610353953 3087 0x683850 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 0 was not flushing
0:00:00.610367521 3087 0x683850 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 1 was not flushing
Framerate set to : 30 at NvxVideoEncoderSetParameter0:00:00.610422529 3087 0x683850 ERROR omxh264enc gstomxh264enc.c:280:gst_omx_h264_enc_set_format:<264encoder> Empty caps
0:00:00.610434753 3087 0x683850 ERROR omxvideoenc gstomxvideoenc.c:1815:gst_omx_video_enc_set_format:<264encoder> Subclass failed to set the new format
0:00:00.610447360 3087 0x683850 WARN videoencoder gstvideoencoder.c:623:gst_video_encoder_setcaps:<264encoder> rejected caps video/x-raw(memory:NVMM), width=(int)640, height=(int)480, format=(string)I420, framerate=(fraction)30/1
0:00:00.610519680 3087 0x683850 INFO GST_STATES gstbin.c:3238:bin_handle_async_done:<avs> committing state from READY to PAUSED, old pending PAUSED
0:00:00.610551008 3087 0x683850 INFO GST_STATES gstbin.c:3258:bin_handle_async_done:<avs> completed state change, pending VOID
0:00:00.610564192 3087 0x683850 INFO GST_STATES gstelement.c:2277:_priv_gst_element_state_changed:<avs> notifying about state-changed READY to PAUSED (VOID_PENDING pending)
0:00:00.610609216 3087 0x683ed0 INFO task gsttask.c:318:gst_task_func:<264encoder:src> Task resume from paused
0:00:00.610625792 3087 0x683ed0 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 0 was not flushing
0:00:00.610641536 3087 0x683ed0 ERROR omx gstomx.c:256:gst_omx_component_handle_messages:<264encoder> encoder port 1 was not flushing
在仔细观察了上限之后,并使用gst-inspect-1.0
,看起来应该接受源和编码器之间的上限,尤其是因为我也设置了上限过滤器。但是,这没有发生,我也不知道为什么会这样。
答案 0 :(得分:0)
使用此流:
uri = 'rtsp://admin:123456@192.168.0.123:554/mpeg4cif'
gst_str = ("rtspsrc location={} latency={} ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, width=(int){}, height=(int){}, format=(string)BGRx ! videoconvert ! appsink sync=false").format(uri, 200, 3072, 2048)
#3072,2048 is frame size
cap= cv2.VideoCapture(gst_str,cv2.CAP_GSTREAMER)
现在,您可以像使用_,frame=cap.read()
的任何视频阅读一样简单地使用它