raspberry piでHDMIキャプチャーをRTSP配信する方法 【サルでもわかる】

Linux

皆さんはスカパープレミアムを見ていますか?チューナーがその部屋にしかない場合、そこの部屋でしか見れませんよね?

ですが、今回はそれを解決するためにラズベリーパイを使って部屋中どこでも見れるようにしたいと思います!

用意するもの




インストール方法

今回、インストールするのは「v4l2rtspserver 」をインストールします。

GitHub - mpromonet/v4l2rtspserver: RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9 - mpromonet/v4l2rtspserver

このソフトは自分でビルドしないといけないので、先に下のソフトを入れます。

端末で下の文字列を一行ずつ入力して実行してください。

sudo apt-get install cmake
sudo apt-get install subversion
sudo apt-get install liblivemedia-dev
sudo apt-get install git

それが終わったらビルドをしていきます。

git clone https://github.com/mpromonet/h264_v4l2_rtspserver.git
cd h264_v4l2_rtspserver
sudo cmake .
sudo make install

エラーが出なかったらインストールは成功しています。

使い方

sudo v4l2rtspserverを実行するだけで起動します。基本的にはvideo0でポートは8554で起動します。
VLCなどで見たいときは、rtsp://[IPアドレス]:8554/unicastを入力すると見れます!

パラメータで好きなように指定することもできます。

v4l2rtspserver [-v[v]] [-Q queueSize] [-O file]
[-I interface] [-P RTSP port] [-p RTSP/HTTP port] [-m multicast url] [-u unicast url] [-M multicast addr] [-c] [-t timeout] [-T] [-S[duration]]
[-r] [-w] [-s] [-f[format] [-W width] [-H height] [-F fps] [device] [device]
-v : verbose
-vv : very verbose
-Q <length> : Number of frame queue (default 5)
-O <output> : Copy captured frame to a file or a V4L2 device
-b <webroot> : path to webroot
RTSP/RTP options
-I <addr> : RTSP interface (default autodetect)
-P <port> : RTSP port (default 8554)
-p <port> : RTSP over HTTP port (default 0)
-U <user>:<pass> : RTSP user and password
-R <realm> : use md5 password ‘md5(<username>:<realm>:<password>’)
-u <url> : unicast url (default unicast)
-m <url> : multicast url (default multicast)
-M <addr> : multicast group:port (default is random_address:20000)
-c : don’t repeat config (default repeat config before IDR frame)
-t <timeout> : RTCP expiration timeout in seconds (default 65)
-S[<duration>] : enable HLS & MPEG-DASH with segment duration in seconds (default 2)
-x <sslkeycert> : enable RTSPS & SRTP
V4L2 options
-r : V4L2 capture using read interface (default use memory mapped buffers)
-w : V4L2 capture using write interface (default use memory mapped buffers)
-B : V4L2 capture using blocking mode (default use non-blocking mode)
-s : V4L2 capture using live555 mainloop (default use a reader thread)
-f : V4L2 capture using current capture format (-W,-H,-F are ignored)
-f<format> : V4L2 capture using format (-W,-H,-F are used)
-W <width> : V4L2 capture width (default 0)
-H <height> : V4L2 capture height (default 0)
-F <fps> : V4L2 capture framerate (default 25)
-G <w>x<h>[x<f>] : V4L2 capture format (default 0x0x25)
ALSA options
-A freq : ALSA capture frequency and channel (default 44100)
-C channels : ALSA capture channels (default 2)
-a fmt : ALSA capture audio format (default S16_BE)
Devices :
[V4L2 device][,ALSA device] : V4L2 capture device or/and ALSA capture device (default /dev/video0,/dev/video0)

 

まとめ

これで簡単に配信をすることができます!

おすすめVODサービス

NETFLIX

ネットフリックスは裏技を使うと1000円で2か月分支払うことができます!

やり方は下の記事を参考にしてください!

Netflixが月350円で見れる?! とてもお得なライフハックを紹介します! 【無料VPN】
皆さんはイカゲームをもう見ましたか?私はまだ一話までしか見ていませんが結構はまりそうですw さらに、VPNを挟めばジブリの作品も見れるので休みの日に見ようかなと思っています。 なので今回は、VPNを使ってNetflixを格安で契約していきた...

U-NEXT

U-NEXTは全話配信しているのでお勧めで、お試し期間を使うと1か月無料で見ることができるのでオススメです!気に入ったらそのまま使うのもいいですね!

230,000本以上が見放題なのも推せる理由です!

しかも、最新映画や漫画の購入・レンタルに使えるポイントを1200ポイント分毎月くれるので、実質2189円-1200円=989円になります!!!

違法サイトの中には偽警告や、怪しいアプリをインストールさせようとするものがあります。

最近では、違法サイトへのブロッキングなどが行われており、摘発もされています。なので、違法サイトでの視聴は絶対やめましょう!

U-NEXTなら公式が配信しているので安心して視聴することができます。安全に見たい場合はU-NEXTの無料トライアルを利用しましょう!

一か月無料で体験できるので是非、体験入会してみてください!

コメント

  1. 参考になりました。ありがとうございます。
    opensslとALSA(音声)のライブラリも必要でしたので、以下も実行しました。

    sudo apt-get install libssl-dev
    sudo apt-get install libasound2-dev

タイトルとURLをコピーしました