2015-03-25 184 views
2

由於相機提供的rtp有效載荷類型是35(未分配),並且接受的有效載荷類型rtph264depay插件處於範圍內,所以我在從特定相機檢索rtsp流時遇到困難[96-127]。其結果是,GStreamer的顯示器安錯誤,如:我已經測試正在努力,因爲它們定義了良好的負載類型Gstreamer,rtspsrc和有效載荷類型

<udpsrc0> error: Internal data flow error. 
<udpsrc0> error: streaming task paused, reason not-linked (-1) 

其它相機。

的FFmpeg,MPlayer和其他工具的Mplayer播放流,儘管它們可能會顯示爲未知類型的警告,例如:

rtsp_session: unsupported RTSP server. Server type is 'unknown' 

有GStreamer的假負載類型的任何方式,忽視不匹配的屬性,強制插件之間的鏈接或以其他方式爲我的問題創建一個workaroud?我使用

管道是:

gst-launcg-0.10 rtspsrc location="..." ! rtph264depay ! capsfilter caps="video/x-h264,width=1920,height=1080,framerate=(fraction)25/1" ! h264parse ! matroskamux ! filesink location="test.mkv" 

回答

4

我想通了,並得到它的工作。在這裏發表一個答案,希望這可能會使某人受益。有多個類似的問題,但他們缺乏正確的答案。

繼的伎倆:

GstElement* depay = gst_element_factory_make("rtph264depay", "video_demux"); 
assert(depay); 
GstPad* depay_sink = gst_element_get_static_pad(depay, "sink"); 
GstCaps* depay_sink_caps = gst_caps_new_simple("application/x-rtp", 
     "media", G_TYPE_STRING, "video", 
     "encoding-name", G_TYPE_STRING, "H264", 
     NULL); 
gst_pad_use_fixed_caps(depay_sink); 
gst_pad_set_caps(depay_sink, depay_sink_caps); 
gst_object_unref(depay_sink); 

它將覆蓋rtph264depay插件的水槽墊帽是限制較少,現在它接受任何有效載荷類型(以及任何時鐘速率),只要它是rtp並且具有H.264編碼。

我不認爲這是可能的gst啓動。

+0

不錯的破解。您可能希望提交Gstreamer的錯誤報告,以防我很快接觸到相機。:) – mpr 2015-03-26 14:46:45

1

有一個在rtspsrc模塊select-stream信號記錄在這裏http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html#GstRTSPSrc-select-stream

這就是你檢查流的回調,如果你回到true,GStreamer的將SETUPPLAY流,如果返回false它會忽略它,這應該讓你忽略不受支持的流,在我的情況下,我有ONVIF元數據流的麻煩,它總是試圖播放它,並沒有解析器,我真的希望gstreamer只會忽略不能播放的流並使用它所具有的功能或至少一個標誌來切換該行爲。