概要
- この辺
- USB接続のWebCamを使用(V4L2?が/dev/video0をうまくやってくれる)
-
Motion
をつかおうと検索してたら、いつのまにかこっちになった??
環境
- Raspberry Pi 3
- USBのWebCam (Buffalo BSW32K01H - 発売日:2009年11月中旬...ふるい)
2016-05-27-raspbian-jessie-lite.img
手順
- いつもの
-
基本的なものを入れる
sudo apt-get install -y build-essential bc git byobu
Janusビルド
-
Janusに必要なものを入れる
sudo apt-get install -y libmicrohttpd-dev libjansson-dev libnice-dev \ libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \ libopus-dev libogg-dev pkg-config gengetopt libtool automake
cd ; git clone https://github.com/meetecho/janus-gateway.git ; cd janus-gateway
-
sh autogen.sh ; CFLAGS=-I/usr/include/glib-2.0 ./configure --disable-websockets --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus ; make
If you're not interested in Data Channels, WebSockets and/or RabbitMQ (or you don't care about either of them) you can disable them when configuring:
ビルドが通ればいいので簡単な設定ににげた
sudo make install; sudo make configs
gstreamerとWebサーバ(nginx)
-
インストール、Janusのファイルのコピー、サービススタートなど
sudo apt-get install gstreamer1.0-omx gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad sudo apt-get install nginx sudo cp -r /opt/janus/share/janus/demos/ /var/www/html/ sudo systemctl enable nginx sudo systemctl start nginx
WebRTCライブストリーミング
- コンソールを2つ開く。(byobu使ったり、sshで2つログインする)
- ひとつはgstreamer起動
- もうひとつは、janus起動
テスト
-
cd plugins/streams/;./test_gstreamer_1.sh
テストスクリプト実行:こんな感じpi@raspberrypi:~/janus-gateway$ cd plugins/streams/ pi@raspberrypi:~/janus-gateway/plugins/streams$ ./test_gstreamer_1.sh Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Redistribute latency... Redistribute latency... Pipeline is PREROLLED ... Setting pipeline to PLAYING ... New clock: GstSystemClock
-
/opt/janus/bin/janus -F /opt/janus/etc/janus/
janus実行こんな感じpi@raspberrypi:~$ /opt/janus/bin/janus -F /opt/janus/etc/janus/ --------------------------------------------------- Starting Meetecho Janus (WebRTC Gateway) v0.1.2 --------------------------------------------------- ... ... JANUS Unix Sockets transport plugin initialized! Unix Sockets thread started Sessions watchdog started [gstreamer-sample] New video stream! (ssrc=4120554784)
gstreamerが走ってないと、最後の
[gstreamer-sample] New video stream!
がでない [Start]
をおして、[Stream list]
から、[Opus/VP8~]
を選択して、[Watch or Listen]
を押す。
WebCamを使ってみる
- うちでは、これでうごきました...フレームレート落としたり...順番変えたり..
gst-launch-1.0 -v v4l2src device=/dev/video0 ! videoscale ! \
video/x-raw,width=320,height=240,framerate=4/1 ! \
videorate ! videoconvert ! timeoverlay ! \
vp8enc error-resilient=true ! \
rtpvp8pay ! udpsink host=127.0.0.1 port=5004
その他
- むつかしいこと、わかりません...
- うまくブラウザに表示されないときは、AdBlockとか NoScriptとか、Ghosteryとか、邪魔してないか見てみよう.
- ラズパイ公式のCamera(MIPI?CSI?インタフェース)だとフレームレートがいいハズ.そのうち試してみよう.