แสดงบทความที่มีป้ายกำกับ raspberry pi แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ raspberry pi แสดงบทความทั้งหมด

วันอาทิตย์ที่ 5 ตุลาคม พ.ศ. 2557

Another Raspberry PI with Kivy and implementation on Twisted.

I visited this site last month. At that time i did not know how to use it. But now i have any idea to do with this.

please visit this. Then i will do my test.


วันอาทิตย์ที่ 28 กันยายน พ.ศ. 2557

Streaming IP Camera to Kivy Video

Finally, after spend 3 weeks with Mac OS X Yosemite , Raspberry Pi, IP Camera that support RTSP Protocol.

Kivy is an amazing framework to start with. It's not new language but it's a new idea to bring the softwares together. GStreamer is a multimedia framework.  I used this for media-handling. It's recommend by Kivy. Compiling this framework is awesome. Homebrew , another tool to get package for Mac. Previously i used fink. OS X Yosemite is my Favourite OS.

I do IP camera streaming by install MJPEG Server on Raspberry PI. But it's a Moving JPEG. Then i want to do more on RTSP and If i have luck, i can stream also audio too.

IP Camera on the market today are support both MJPEG an RTSP. But if you want to get both Video and Audio you need RTSP.

Then, this is my target.

First install Kivy. You can easily install Kivy by get the package on the Kivy web site. But I'm interesting to set up GStreamer on OS X Yosemite..

Let's compile the GStreamer.

First you need to install Homebrew. Again you can install Homebrew easy by follow the instruction from the web site.

If you install GStreamer follow the instruction on Kivy. You will only get few of pipeline. I need more pipeline!

(If you're on Debian. Believe me, Building GStreamer on Debian is very funny and easy!)

You have to read more instruction on Homebrew.

0. Install Xcode and Xcode Command Line Tool (CLT)
Without Xcode and Xcode Command Line Tool you will get error when compiling. Please see detail.

1. Install pygobject3 
$ brew install pygobject3

2. Install gstreamer
$ brew install gstreamer --with-gobject-introspection

After you've build gstreamer. Please see the core elements from $ gst-inspect-1.0  . It will help you to understand what gstreamer is.

I recommend to also install gst-libav. it's former ffmpeg.
$ brew install gst-libav


3. Install gst-plugins-base
Before you install gst-plugins-base please see $ brew edit gst-plugins-base  output. Then you command will be $ brew install gst-plugins-base --with-orc --with-gtk+ --with-libogg --with-pango --with-theora --with-libvorbis --with-gobject-introspection 

At this plugins i would recommend you to see the plugin list here. Then you can decide which plugins you need to install. 

After finished please see $ gst-inspect-1.0 output. You will see the list of plugins.

4. Install gst-plugins-good
Again, see the plugins list here. Then run $ brew edit gst-plugins-good . My installation would be

$ brew install gst-plugins-good --with-gobject-introspection --with-orc --with-gtk+ --with-aalib --with-libcdio --with-esound --with-flac --with-jpeg --with-libcaca --with-libdv --with-libshout --with-speex --with-taglib --with-libpng --with-libogg

Again. after finished please $ gst-inspect-1.0 output.

5. Install gst-plugins-bad
Then for gat-plugins-bad i also do the same way. My installation would be

$ brew install gst-plugins-bad --with-gobject-introspeciton  --with-faac --with-facc2 --with-gnutls --with-libdvdread --with-libexif --with-libmms --with-rtmpdump --with-schroedinger

note: disable dirac because it's error.

6. Install gst-plugins-ugly

My installation would be.
$ brew install gst-plugins-ugly --with-gobject-introspection --with-mad --with-jpeg --with-libvorbis --with-cdparanoia --with-lame --with-two-lame --with-libshout --with-aalib --with-libcaca --with-libdvdread --with-libmpeg2 --with-a52dec --with-liboil --with-flac --with-gtk+ --with-pango --with-theora --with-libmms --with-x264 --with-opencore-amr

note: x264 is a library that often used, don't forget

Luckily  i have

Total count: 163 plugins, 612 features

Test videotestsrc with this

$ gst-launch-1.0 videotestsrc ! autovideosink


It's amazing output on OpenGL. This is a very very famous test source for beginner.

The part to install GStreamer with plugins is completed here. But we need gst-rtsp-server

Please visit GStreamer RTSP Server Library page here.

7. Install GStreamer RTSPServer
For this you can now install gst-rtsp-server from ./autogen.sh . But for me. I'm have to do some with brew

Create brewing GstRtspStreamer
$ brew create http://anongit.freedesktop.org/git/gstreamer/gst-rtsp-server --set-name GstRtspServer

Edit GstRtspStreamer Formular
$ brew edit  GstRtspServer
Then i do a bit of change. This is my version of GstRtspServer Formular.
require "formula"

class Gstrtspserver < Formula
  homepage "http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/"
  url "http://anongit.freedesktop.org/git/gstreamer/gst-rtsp-server", :using => :git, :tag => "1.4.2"
  sha1 ""

  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "gettext" => :build
  depends_on "glib" => :build
  depends_on "pkg-config" => :build

  depends_on "gtk-doc" => :build
  depends_on "gstreamer" => :build
  depends_on "gst-plugins-base" => :build

  def install
    system "./autogen.sh"
    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}"
    system "make"
    system "make install"
  end

end

Install our Formula GstRtspStreamer
$ brew install --debug --verbose  GstRtspServer

Yes, you can now have gst-rtsp-server library. You can go to make a test from git like this.
$ git clone --branch 1.4.2 git://anongit.freedesktop.org/gstreamer/gst-rtsp-server

$ cd gst-rtsp-server

$ ./autogen.sh

This will failed you! Please update path to support Brew
$ export PATH="/usr/local/opt/gettext/bin:$PATH"

$ ./autogen.sh

$ ./configure

$ make

Let's go to example folder 
$ cd examples/

Then Launch RTSP Server
$ ./test-launch "( videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 )"

From VLC try to open the network streaming from the streaming you see!

But for me i want to show you the easy from GStreamer, gst-launch-1.0 

Open new terminal and then try this command
$ gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/test  ! rtph264depay ! decodebin ! autovideosink

Yes for the proxy rtsp-server you can change 'videotestsrc' to 'v4l2src'

Because i'm test on the Raspberry Pi with Raspberry PI Camera Module. It's easy to try!

Kivy Layout.
It's also easy to display the Video Stream from Kivy Please try to change your widget like this

    Video:
        source: 'rtsp://127.0.0.1:8554/test'
        size_hint: .5, .5

        state: 'play'




วันเสาร์ที่ 17 พฤษภาคม พ.ศ. 2557

Raspberry Pi

The world "Raspberry Pi" was the nothing to me until now. I have a simple project to quickly continue develop for one of the company.

It's web server on #Raspberry Pi. It's a small project to complete hospitality service in hospital.

But it's first time to go with #Raspberry Pi.


Read again...