LoginSignup
10
9

More than 5 years have passed since last update.

Pepper のカメラ映像をライブ配信する実験

Last updated at Posted at 2015-01-28

はじめに

  • タイトルの通り、Pepper のカメラ映像をライブ配信(リアルタイムでストリーミング)を行いたいと思っているのですが、まだ実現できていません。これは 失敗 の記録です。
  • まずは API で実現できないか、ざっくり各 API を確認してみたのですが、一番あやしいと感じた ALVideoDevice あたりでも、実現できそうな機能はないように思いました。
  • ではカメラデバイスから直接に映像データを取得し、適当な形式に変換するイメージで何とかならないだろうか、と考えています。

案1 HTTP Live Streaming (HLS) を使用

案1-1 Pepper 内に FFmpeg がインストールされているならば、それを使用してインデックスファイル(.m3u8)とセグメントファイル(.ts)を生成できるのではないか

それをどこかの Web サーバに転送すれば、一番手っ取り早く実現できそうな気がしました。Pepper にログインして、ffmpeg を確認します。

$ which ffmpeg
/usr/bin/ffmpeg 

インストールされているようです。バージョンはいくつかな?

$ ffmpeg -version
ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers

何やら古そうです。セグメンタ機能が実装されているのか不安です。とりあえず適当に動画を書き出してみます。

$ ffmpeg -i /dev/video0 video.mpg
ffmpeg version 0.7.8, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 13 2014 18:10:07 with gcc 4.5.3
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --enable-shared --cc=i686-pc-linux-gnu-gcc --disable-static --enable-gpl --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-network --disable-vaapi --disable-ffplay --disable-vdpau --disable-indev=v4l --disable-indev=oss --disable-indev=jack --disable-outdev=oss --disable-altivec --disable-avx --cpu=atom --enable-hardcoded-tables
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
/dev/video0: Operation not permitted

予想外のエラーです。/dev/video0 のパーミッションを確認します。

$ ls -la /dev/video0
crw-rw----  1 root video  81,   0 Jan 28 16:36 /dev/video0

ちなみにローカルマシンの Ubuntu では同じコマンドが動いているのですが、同様に /dev/video0 のパーミッションはこんな感じです。最後の「+」ってなんでしたっけ?

$ ls -la /dev/video0
crw-rw----+ 1 root video 81, 0 Jan 28 19:10 /dev/video0

何にしても、パーミッションは触れないので、なかなか難しいそうな感じがします。

次回へ続く(?)。

感想

  • 01/31(土)のアトリエ秋葉原の開発タッチ&トライに登録しているので、それまでに次案を考えます。
  • Choregraphe とか Monitor とかはどうやってるのでしょうかね?
10
9
1

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
10
9