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

วันพฤหัสบดีที่ 19 พฤศจิกายน พ.ศ. 2563

Kivy on Big Sur , Mac OS X 11.0.1

 A few project i used Kivy(www.kivy.org).

When Mac OS X 11.0.1 Big Sur come. I need to recompile Kivy again. Here is my way.


Python3.7 from brew

Gstreamer-1.0-1.18.0-x86_64 (http://gstreamer.freedesktop.org/data/pkg/osx/1.18.0/gstreamer-1.0-1.18.0-x86_64.pkg)

Gstreamer-1.0-devel-1.18.0-x86_64 (http://gstreamer.freedesktop.org/data/pkg/osx/1.18.0/gstreamer-1.0-devel-1.18.0-x86_64.pkg)

SDL2-2.0.12 (https://www.libsdl.org/release/SDL2-2.0.12.dmg)

SDL2_image-2.0.5 (https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.dmg)

SDL2_mixer-2.0.4 (https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.dmg)

SDL2_ttf-2.0.15

# Install python3.7

$ brew install python@3.7


# Create new virtualenv

$ virtualenv -p /usr/local/opt/python@3.7/bin/python python3env


# Install SDL2 Gstreamer from here (https://kivy.org/doc/stable/installation/installation-devel.html#)


# then install kivy 1.11.1 from Kivy

# Updated 2.0.0 passed test.

$ pip install https://github.com/kivy/kivy/archive/stable.zip

Successfully installed Kivy-1.11.1 Kivy-Garden-0.1.4 certifi-2020.11.8 chardet-3.0.4 docutils-0.16 idna-2.10 pygments-2.7.2 requests-2.25.0 urllib3-1.26.2

Good Luck!

วันอาทิตย์ที่ 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

Another i like most on Mac OS X Yosemite

I wonder about the new Mac OS X Yosemite feature,

Instead show the flag i'm using on keyboard layout, Now is the first Thai character is "Ko Kai"


วันอังคารที่ 4 พฤษภาคม พ.ศ. 2553

ปฏิทินวันหยุด

วันนี้มีน้องที่บริษัท มาให้ลงชื่อเอกสารลาหยุด สิ่งที่ต้องทำเสมอคือ


  1. เปิด iCal ขึ้นมาแล้วตรวจสอบว่ามีวันหยุดของคนอื่นตรงกันหรือไม่ เผื่อลูกค้าต้องการบริการ จะได้มีคนคอยช่วยเหลือหน่อย
  2. คนนี้หยุดไปแล้วกี่ครั้งในปีปฏิทิน
  3. ตรวจดูว่าตรงกับวันหยุดตามปฏิทินหรือไม่

ก็นึกขึ้นได้ว่าปกติที่บริษัทจะยึดปฏิทินของธนาคารเป็นหลัก แต่ว่าจะเอาวันหยุดประจำปีจากปฏิทินธนาคารมาใส่ไว้ใน iCal อย่างไรเนี่ย

ค้นใน Google ก่อน ถ้าไม่มีใครรวบรวม ก็คงเขียน App ขึ้นมาเผื่อแผ่คนอื่นใช้กันบ้างแล้ว!

Updated: 17:36 - เป็นเล่นน่า ไม่มีเป็น iCal ที่ Share ให้ใช้แฮะ มีอันนี้ที่พอดูได้ (icalshare.com)
Updated: 17:38 - ต้องทำไว้ใช้ซะแล้ว
Updated: 17:51 - เจอแล้ว อันนี้ครับ http://icalshare.com/calendars/48 , webcal://ical.mac.com/ical/Thai32Holidays.ics

มันเป็น App ที่ธรรมดา แต่ว่ามีประโยชน์เหมือน "swiss-army knife"