10

私は GStreamer アプリケーションを開発しており、着信 RTP ストリーム用のプレーヤーの実装に少し苦労しています。gstrtpbin 要素の周りにパイプラインを構築しようとしています。gst-launch 構造を使用してパイプラインをモデル化しようとしています。

VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"

gst-launch -v udpsrc caps=$VIDEO_CAPS port=4444 \
              ! gstrtpbin .recv_rtp_sink_0 \
              ! rtph264depay ! ffdec_h264 ! xvimagesink

スクリプト GStreamer を起動すると、次のエラーが報告されます。

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0: ntp-ns-base = 3469468914024449000
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0.GstProxyPad:proxypad0: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:src: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_src_0_960476599_33.GstProxyPad:proxypad1: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)33
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2378): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-linked (-1)
Execution ended after 209381685 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_src_0_960476599_33: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:src_33: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpPtDemux:rtpptdemux0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpJitterBuffer:rtpjitterbuffer0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:src_960476599: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSsrcDemux:rtpssrcdemux0.GstPad:sink: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_src: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:recv_rtp_sink: caps = NULL
/GstPipeline:pipeline0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_sink_0: caps = NULL
/GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = NULL
Setting pipeline to NULL ...
Freeing pipeline ...

playbin と SDP ファイルで動作することに言及する必要があります。たとえば、次のファイル:

v=0
o=- 1188340656180883 1 IN IP4 127.0.0.1
s=Session streamed by GStreamer
i=server.sh
t=0 0
a=tool:GStreamer
a=type:broadcast
m=video 4444 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000

次のようにストリームを再生するために使用できます。

gst-launch -vvv playbin uri=file://`pwd`/stream.sdp

完全を期すために:VLCを使用してデータを送信しています。これはコマンドです:

vlc -I rc /usr/local/movies/sample.mp4 \
    --screen-fps=10 :screen-caching=100 \
    --sout='#transcode{vcodec=h264,venc=x264{bframes=0,keyint=40},vb=512}:\
                   rtp{mux=ts,dst=127.0.0.1,port=4444}'

gst-launch スクリプトが失敗する理由を誰かが理解するのを手伝ってくれますか? 「リンクされていない理由」というエラーは、gstrtpbin と rtph264depay 要素の間のリンクが壊れていると思わせます。しかし、私はそれを修正する方法がわかりません。

編集
RAOF の提案に従って、コマンドのいくつかのエラーを修正しました。ただし、私の Windows システムでは、fluh264dec および xvimage シンク プラグインがインストールされていないため、ffdec_h264 および autovideosink を使用しています。

gst-launch-0.10 udpsrc port=4444 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" ! .recv_rtp_sink_0 gstrtpbin ! rtpmp2tdepay ! mpegtsdemux ! ffdec_h264 ! autovideosink 

これにより、新しいエラーが発生します。

0:00:00.743000000   516   024070A8 ERROR                 ffmpeg .:0:: non-existing PPS referenced
0:00:00.744000000   516   024070A8 ERROR                 ffmpeg .:0:: non-existing PPS referenced
0:00:00.745000000   516   024070A8 ERROR                 ffmpeg .:0:: decode_slice_header error
0:00:00.745000000   516   024070A8 ERROR                 ffmpeg .:0:: no frame!
0:00:00.812000000   516   024070A8 ERROR                 ffmpeg .:0:: non-existing PPS referenced
0:00:00.813000000   516   024070A8 ERROR                 ffmpeg .:0:: non-existi
...
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data flow
 error.
Additional debug info:
..\Source\gstreamer\libs\gst\base\gstbasesrc.c(2378): gst_base_src_loop (): /Gst
Pipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 4790000000 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

私はまだこれを修正する方法を見つけようとしています。お手伝いできることがあれば、お気軽にどうぞ。

Edit2
SDP ソリューションを使用して再度テストしたところ、「存在しない PPS」エラーも発生することがわかりましたが、ビデオは再生されます。一方、致命的な「内部データ フロー エラー」は、カスタム パイプライン ソリューションを使用している場合にのみ表示されます。「存在しない PPS」エラーは、x264 エンコーダーが原因であると思われます。「内部データ フロー エラー」は、パイプラインのエラー、またはおそらく Windows プラグインのバグが原因である必要があります。ということで、さらに研究を重ねます…

4

3 に答える 3

12

私が知る限り、そこには 2 つの問題があります。

まず、シンク指定の順序が重要なようです:... ! gstrtpbin .recv_rtp_sink_0 ! ...必要があるのではなく... ! .recv_rtp_sink_0 gstrtpbin ! ....

第二に、vlc は MPEG2 トランスポート ストリームを送信してmux=tsいます - rtp ストリーミング出力記述子を持っていますが、生の h264 ストリームをデペイロードしようとしています。ts ストリームを depayload してから、h264 ストリーム データを取得するために demux する必要があります。

最後に、パイプライン

gst-launch-0.10 -v udpsrc port=4444 \
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264" \
! .recv_rtp_sink_0 gstrtpbin ! rtpmp2tdepay \
! mpegtsdemux ! fluh264dec ! xvimagesink

TSデマルチプレクサー(mpegtsdemux)とh264デコーダー(fluh264dec)を使用して、私にとってはうまくいきます。

于 2009-12-22T03:21:38.177 に答える
1
gst-launch-0.10 -vvvv rtspsrc location=rtsp://192.168.250.100:554 latency=100 ! \
application/x-rtp,media="video",payload=99,clock-rate=90000,encoding-name="H264"  ! \
rtph264depay !  ffdec_h264 ! ffmpegcolorspace ! xvimagesink

これは「Grandtec Electronic MegaPixel WIFI CAM」でうまくいきました

于 2012-05-04T17:59:43.747 に答える
0

これを試すこともできます。

gst-launch-0.10 -v rtspsrc location="rtsp://10.107.2.217/StreamingSetting?version=1.0&action=getRTSPStream&ChannelID=1&ChannelName=Channel1" user-id=admin user-pw=admin123 caps=" application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96,ssrc=(uint)237526004,clock-base=(uint)1584170994,seqnum-base=(uint)42626" port=554 ! rtph264depay queue-delay=0 ! h264parse ! decodebin2 ! queue leaky=1 ! autovideosink

ネットワーク上のストリーミングが安全な場合にも機能し、

rtsp://10.107.2.217

RTSP Port : 554

Video Codec : H.264

お役に立てば幸いです。

于 2014-03-26T08:29:05.867 に答える