LoginSignup
12
7

More than 3 years have passed since last update.

ネットワークカメラのRTSPをgstreamerで読み込む際に、gstreamer1.0-plugins-uglyをアンインストールするとうまくいった話

Posted at

問題の現象と解決策

ネットワークカメラのRTSPをgstreamerで読み込む際にハマったので問題と解決策を残しておきます。

現象: ネットワークカメラ(RTSPで配信)の映像をgstreamerで読み込む際に、Bad Request (400)となりRTSPサーバーに接続できない。

解決策: gstreamer1.0-plugins-uglyをアンインストールします。以下のサイトに情報があります。特定のネットワークカメラで起きるようです。

rtspsrc authorisation problem.
http://gstreamer-devel.966125.n4.nabble.com/rtspsrc-authorisation-problem-td4679792.html

Bug 772043 - rtsp real extensions make some rtsp streams unplayable
https://bugzilla.gnome.org/show_bug.cgi?id=772043

環境

Jetson TX2 (Jetpack 4.3)
mac Mojave
ネットワークカメラ:Panasonic BB-SP104W
image.png

plugins-uglyの削除コマンド

Jetsonでは以下のコマンドでgstreamer1.0-plugins-uglyを削除します。

sudo apt remove gstreamer1.0-plugins-ugly

Macでは、以下のコマンドでgst-plugins-uglyを削除します。

brew uninstall gst-plugins-ugly 

エラー時のメッセージ

ネットワークカメラのRTSPをgstreamerで読み込む際に発生したエラーメッセージです。
GST_DEBUGを設定してログを確認すると”Bad Request (400)”でRTSPサーバーへの接続が失敗していることが確認できます。

$ GST_DEBUG=3 gst-launch-1.0 -v rtspsrc location=rtsp://192.168.0.10:554/MediaInput/h264  user-id="admin" user-pw="password" ! fakesink dump=true
パイプラインを一時停止 (PAUSED) にしています...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.0.10:554/MediaInput/h264
Progress: (open) Retrieving server options
0:00:00.059070000 98217 0x7fb9ef883850 WARN                 rtspsrc gstrtspsrc.c:6564:gst_rtspsrc_send:<rtspsrc0> error: Unhandled error
0:00:00.059149000 98217 0x7fb9ef883850 WARN                 rtspsrc gstrtspsrc.c:6564:gst_rtspsrc_send:<rtspsrc0> error: Bad Request (400)
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unhandled error
0:00:00.059487000 98217 0x7fb9ef883850 WARN                 rtspsrc gstrtspsrc.c:7951:gst_rtspsrc_open:<rtspsrc0> can't get sdp
追加のデバッグ情報:
gstrtspsrc.c(6564): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Bad Request (400)
0:00:00.059594000 98217 0x7fb9ef883850 WARN                 rtspsrc gstrtspsrc.c:6031:gst_rtspsrc_loop:<rtspsrc0> we are not connected
ERROR: pipeline doesn't want to preroll.
パイプラインを一時停止 (PAUSED) にしています...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

参考: テストの際に試したコマンド

環境変数にGST_DEBUG=X(Xは1-9の数字)をするとログの出力量を増やせます。
fakesink dump=trueで入力をダンプすることができます。とりあえずストリームに接続出来てデータが流れてきているかを確認出来ます。

$ GST_DEBUG=3 gst-launch-1.0 -v rtspsrc location=rtsp://192.168.0.10:554/MediaInput/h264  user-id="admin" user-pw="password" ! fakesink dump=true

decodebin ! autovideosinkでいい感じにデコードして画面に映像を表示できます。

$ GST_DEBUG=3 gst-launch-1.0 -v rtspsrc location=rtsp://192.168.0.10:554/MediaInput/h264 user-id="admin" user-pw="password" ! decodebin ! autovideosink

gst-play-1.0を使ってストリームを再生し、画面で確認することが出来ます。

$ gst-play-1.0 rtsp://admin:password@192.168.0.10:554/MediaInput/h264 
12
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
7