Pipelight でSilverlight を / RaspberryPi でリアルタイム動画
配信をその3
KenichiroMATOHARA(matoken)<[email protected]>
Linux - 03 -鹿児島 勉強会 第 回2014-07-25(Fri)
7F 2よかセンター 第 会議室
KenichiroMATOHARA
● ID : matoken● http://matoken.org/● 興味
● Linux● FLOSS● OpenSteetmap● 電子工作● :
今日のネタ
● Pipelight でSilverlightを● RaspberryPi でリアルタイム動画配信をその
3
Pipelight でSilverlightを
Pipelight?
● Wineを使ってSilverlight などを動かす● Moonlight と違ってWine経由でSilverlightを動かすのでDRMのあるコンテンツだってOK
Pipelight Launchpad project page https://launchpad.net/pipelight ,⟨ ⟩
Installation instructions http://pipelight.net/cms/installation.html ,⟨ ⟩
#pipelight on IRC freenode
導入
● DebianJessieでPipelight導入$ sudo apt-get install pipelight
● ブラウザはIceweasel 30.0を利用● UA偽装
User Agent Overrider( https://addons.mozilla.org/ja/firefox/addon/user-agent-overrider/ )を導入してWin IE11 に
● Silverlight 有効に% sudo pipelight-plugin --accept --enable silverlight
プラグインの確認
● about:plugins で確認できる●
再生できた
問題点
● 映像と音のズレ● サブディスプレイで再生されない?
プライマリ側再生されている
セカンダリ側ウィンドウを移動した時の再生画面で止まっている
● 結局OPしか見てない><
● でも個人的にSilverlightでできているルート♪ラボが閲覧できるようになったのが嬉しい
RaspberryPi でリアルタイム配信をその3
これまでのRasPiストリーミング● ひよこチャンネル(ひよこを中継)
http://www.slideshare.net/matoken/lt-raspberry-pi
UVCなWebCamをUSB HUB経由でJustin.TVへリアルタイム配信1~2fps…
● ハードウェア支援付きで高画質配信(OSHWCを中継) https://plus.google.com/u/0/+KenichiroMATOHARA/posts/6Qmc2LBuoSQRaspberriPi純正カメラ経由でハードウェアエンコーディングでJustin.tv
但し映像のみ
今回は音声も!
● RaspberryPi には音声入力がない● USB Audio を接続(MI-305 $3.6)
● 刺すだけで認識
"MI-305 The World's Smallest USB 2.0 Microphone - Black - Free Shipping - DealExtreme" http://www.dx.com/p/mi-305-the-world-s-smallest-usb-2-0-microphone-black-285812#.U81KinV_u00
→ 詳細https://gist.github.com/matoken/457f5e5f0ecb35d7f252
USB Audioのテスト
● カード確認
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
● 録音のテスト$ AUDIODRIVER=alsa AUDIODEV=plughw:1,0 rec test.mp3
Input File : 'plughw:1,0' (alsa)
Channels : 2
Sample Rate : 48000
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM
In:0.00% 00:00:12.54 [00:00:00.00] Out:598k [ | ] Clip:0 ^C
Aborted.
コマンドラインから配信する例
● "ffmpeg でUstream.tv 配信 - Qiita" http://qiita.com/matoken/items/37c3e158f145d8f59047
● "ffmpeg でJustin.tv 配信 - Qiita" http://qiita.com/matoken/items/d08d28e88b28fc858fdc
音声付きストリーミング行けた!
$ raspivid -o - -t 0 -w 320 -h 240 | avconv -r 4 -b 160k -rtbufsize 32MB -i - -f alsa -i plughw:1,0 -acodec libmp3lame rtmp://x.xxxxxxxx.fme.ustream.tv/ustreamVideo/xxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.flv
…音飛びする
● 数秒ごとに以下のメッセージが出て音飛びがする.
ALSA buffer xrun.
● CPUを使いきっているよう
色々ダイエット
● → ステレオ モノラル● サンプリングレート48kHz → 8kHz
(mp3->aac)
コマンド
$ raspivid -o - -t 0 -w 320 -h 240 | avconv -r 4 -b 120k -rtbufsize 32MB -i - -ar 8000 -f alsa -i plughw:1,0 -acodec aac -ab 32k -ar 8000 -strict experimental -ac 1 rtmp://x.xxxxxx.fme.ustream.tv/ustreamVideo/xxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.flv
● 朝から昼すぎまで動かしてみて ALSA buffer xrun. は出なくなった!
課題
● 音が小さい感じ● ハードウェアエンコーディングは出来ないかな?
● FSのRO化(電源ブチ切り可能なように)
● GPIOにボタンを付けて簡易操作● ローカル録画機能
Credits & License
● Content by KenichiroMATOHARA(matoken)http://matoken.org/License: CC-BY-SA
● OpenOffice.org template by Raphaël Hertzoghttp://raphaelhertzog.com/go/ooo-templateLicense: GPL-2+
● Background image by Alexis Younes “ayo”http://www.73lab.comLicense: GPL-2+