LoginSignup
5
4

More than 1 year has passed since last update.

macでrtspサーバを立てる

Last updated at Posted at 2021-12-27

gstreamerをインストール

$ brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad
$ brew install gst-plugins-ugly
$ brew install gst-rtsp-server
$ gst-launch-1.0 --version
gst-launch-1.0 version 1.18.5
GStreamer 1.18.5
Unknown package origin

参考: https://dev.classmethod.jp/articles/gstreamer-on-macos-video/

rtsp-simple-serverをインストールして起動

  1. リリースページから最新の rtsp-simple-server_v0.XX.XX_darwin_amd64.tar.gz をダウンロードして解凍する。
  2. サーバを起動する
./rtsp-simple-server

ストリームをpublishする

テストビデオ(時間付き)

$ gst-launch-1.0 videotestsrc ! timeoverlay font-desc="Sans 36" ! capsfilter caps="video/x-raw" ! queue ! x264enc ! rtspclientsink location=rtsp://localhost:8554/mystream

カメラ画像(時間付き)

$ gst-launch-1.0 avfvideosrc ! timeoverlay font-desc="Sans 36" ! capsfilter caps="video/x-raw" ! queue ! x264enc ! rtspclientsink location=rtsp://localhost:8554/mystream

参考: https://stackoverflow.com/a/47088647/4791194

ストリームを開く

  1. VLCをインストールして起動する
  2. VLCメニュー > ファイル > ネットワークを開く
  3. URLに「rtsp://localhost:8554/mystream」を入力して開く vlc.png
  4. 以下のような動画が表示される スクリーンショット 2022-01-06 9.46.30.png

(VLCインストール後はChromeにrtspのURLを指定してストリームを開くこともできます)

5
4
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
5
4