2010/09/20

[font - vl gothic]

http://vlgothic.dicey.org/
DL: VLGothic-20100818.tar.bz2

# tar jxf VLGothic-20100818.tar.bz2
# cp VLGothic/*.ttf /usr/share/wine/fonts/

[PHP - Command Line]

$ /usr/local/bin/php -f xxxxx.php

or

$ vi xxxxx.php
#!/usr/local/bin/php
<?php
    ・
    ・
    ・
?>
$ ./xxxxx.php

2010/09/18

[PHP - Image Resize]

大きいイメージデータの解像度を下げて、
ファイルサイズも抑えるようなPHPサンプルコード

$filename="xxx.png";
$filename_new="xxx.jpg";

$fp=fopen($filename,"rb");
$imgdata=fread($fp,8);
fclose($fp);

if(preg_match('/^\x89PNG\x0d\x0a\x1a\x0a/',$imgdata)){
    $img=imagecreatefrompng($filename);
}elseif(preg_match('/^GIF8[79]a/',$imgdata)){
    $img=imagecreatefromgif($filename);
}elseif(preg_match('/^\xff\xd8/',$imgdata)){
    $img=imagecreatefromjpeg($filename);
}

list($width,$height)=getimagesize($filename);
$new_height=1024;
$new_width=($new_height/$height)*$width;
$new_img=ImageCreateTrueColor($new_width, $new_height);
ImageCopyResampled($new_img,$img,0,0,0,0,$new_width,$new_height,$width,$height);
imagejpeg($new_img,$filename_new,50);

2010/09/15

[FlashMediaServer Setting]

インストールディレクトリにconf/fms.iniがあるので目的に応じて編集

動画ファイルをダウンロードせずに再生が目的なので、
RTMPだけ使えればいいので余計なのはコメントアウトなど

# vi /usr/local/fms/conf
SERVER.ADMIN_USERNAME = xxxxxx
SERVER.ADMIN_PASSWORD = xxxxxx
SERVER.ADMINSERVER_HOSTPORT = :1111
SERVER.PROCESS_UID = 99
SERVER.PROCESS_GID = 99
SERVER.LICENSEINFO =
VOD_COMMON_DIR = /work/media ←動画ファイルの場所
SERVER.FLVCACHE_MAXSIZE=1000
SERVER.HTTPD_ENABLED = false
ADAPTOR.HOSTPORT = :1935 ←使用ポート
HTTPPROXY.HOST = :8134
VHOST.APPSDIR = /usr/local/fms/applications
APP.JS_SCRIPTLIBPATH = /usr/local/fms/scriptlib
LOGGER.LOGDIR =
USERS.HTTPCOMMAND_ALLOW = false

付属のサンプルページがあるのでapacheの設定を行ってテストを行う
# vi /usr/local/apache2/conf/http.conf
Alias /fmsadmin/ "/usr/local/fms/webroot/"
<Directory /usr/local/fms/webroot/>
    Options +MultiViews
    AllowOverride AuthConfig
    order deny,allow
    allow from 192.168
</Directory>

クライアントで再生するために必要なswf、jsなども用意されてるので
htmlを読むとこれらの使いかたを理解できるのではないかと思う・・・

ちなみに再生できるエンコードはFLVやmp4(h264/aac)

2010/09/10

[GoogleChrom Install for CentOS]

[Reference site]
http://slashdot.jp/~RK/journal/502045
http://www.linux-powered.com/~ryoji.kamei/ChromiumCentOS5.xhtml

[FlashMediaServer Update]

サイトを確認したらアップデート版があったので
ダウンロードしてみたら、普通にこれだけでインストールできるものだった。

FlashMediaServer3.5.4 と FlashMediaServer4があったが
始めはVer.3の方をインストール

# tar zxf FlashMediaServer3.5.tar.gz
# cd FMS_3_5_4_r210
# ls -la
drwxrwxr-x 14 root   root      4096  9月 10 13:08 Apache2.2
-rw-r--r--  1 root   root     81389  7月 16 14:01 License.htm
-rw-r--r--  1 root   root     39294  7月 16 14:01 License.txt
-rwxr-xr-x  1 root   root      2886  7月 16 14:28 adminserver
drwxr-xr-x  4 root   root      4096  7月 16 14:28 applications
-rwxr-xr-x  1 root   root     16159  7月 16 14:01 checksn
drwxrwxr-x  3 root   root      4096  9月 10 14:20 conf
drwxrwxr-x  5 root   root      4096  9月 10 14:20 documentation
-rwxr-xr-x  1 root   root    877260  7月 16 14:29 far
-rwxr-xr-x  1 root   root      1699  7月 16 14:28 fms
-rwxr-xr-x  1 root   root   3624248  7月 16 14:29 fmsadmin
-rwxr-xr-x  1 root   root    438756  7月 16 14:29 fmsconfig
-rwxr-xr-x  1 root   root   8168992  7月 16 14:29 fmscore
-rwxr-xr-x  1 root   root   3837608  7月 16 14:29 fmsedge
-rwxr-xr-x  1 root   root    273776  7月 16 14:29 fmsini
-rwxr-xr-x  1 root   root   3154956  7月 16 14:29 fmsmaster
-rwxr-xr-x  1 root   root      5252  7月 16 14:28 fmsmgr
-rwxr-xr-x  1 root   root     35168  7月 16 14:28 installFMS
-rwxr-xr-x  1 root   root     36056  7月 16 14:29 libasneu.so.1
-rw-r--r--  1 root   root    135920  7月 16 14:01 libexpat.so.1
drwxr-xr-x  2 root   root      4096  9月 10 14:20 licenses
-rw-r--r--  1 root   root     52278  7月 16 14:01 logo.gif
drwxrwxr-x  4 root   root      4096  9月 10 13:08 modules
-rw-r--r--  1 root   root     67417  7月 16 14:01 readme.htm
drwxrwxr-x  5 root   root      4096  9月 10 13:08 samples
drwxrwxr-x  4 root   root      4096  9月 10 14:20 scriptlib
-rwxr-xr-x  1 root   root      4812  7月 16 14:28 server
-rwxr-xr-x  1 root   root    286396  7月 16 14:29 shmrd
-rwxr-xr-x  1 root   root     32213  7月 16 14:04 tcSrvMsg
drwxrwxr-x  2 root   root      4096  9月 10 14:20 tools
-rwxr-xr-x  1 root   root      2250  7月 16 14:28 uninstallFMS
drwxrwxr-x  7 root   root      4096  9月 10 14:20 webroot
# ./installFMS

[FlashMediaServer Install]

# unzip Flashmedia3_5_Int_Strm_ALP.zip
# cd Flashmedia3_5_Int_Strm_ALP
# ls -la
drwxr-xr-x 4 root root 4096 1月 15 2010 .
drwxr-xr-x 7 root root 4096 9月 10 12:46 ..
drwxr-xr-x 5 root root 4096 2月 17 2009 Documentation
-rw-r--r-- 1 root root 100154880 2月 5 2009 FlashMediaServer3.5.exe
-rw-r--r-- 1 root root 104494514 2月 4 2009 FlashMediaServer3.5.tar.gz
-rw-r--r-- 1 root root 39471 12月 11 2008 License.txt
drwxr-xr-x 3 root root 4096 2月 17 2009 Sample Video
-rw-r--r-- 1 root root 58 12月 8 2008 autorun.inf
-rw-r--r-- 1 root root 25214 10月 13 2008 cdicon.ico
-rw-r--r-- 1 root root 61442 1月 14 2009 readme.htm
# tar zxf FlashMediaServer3.5.tar.gz
# cd FMS_3_5_1_r516
# ./installFMS
WARNING: Your distribution, unknown, is not supported by this
Adobe Flash Media Server installer.


Copyright(C) 1993-2009 Adobe Systems Incorporated. All rights reserved.

Adobe Flash Media Server 3.5.1 for Linux

Adobe Flash Media Server 3.5.1 will be installed on this machine.

You will be asked a series of questions during the install
process and will be presented with the defaults for these questions.

Support is available at http://www.adobe.com/go/flashmediaserver_en

To install Adobe Flash Media Server now, press ENTER.

To cancel the installation at any time, press Control-C.
[ENTER]

Do you agree with the license agreement? (y/n): y

Please enter your Flash Media Server 3.5.1 serial number.

You have not entered a serial number. Falling back to
the Adobe Flash Media Development Server!

Would you like to try again? y/n: Default [n]:

Adobe Flash Media Server 3.5.1 requires approximately 200MB of
disk space.

The installer will install Adobe Flash Media Server 3.5.1 in the
following directory
Default [/opt/adobe/fms]:


The Adobe Flash Media Server communicates on the IANA-assigned
port of 1935, which is the port most Flash applications expect,
and can also communicate on port 80, both for tunneling Flash
over HTTP, and for proxying HTTP to a webserver.

Please enter the Adobe Flash Media Server port(s), comma-separated
Default [1935,80]:

Please enter the port to use for the Admin service. You can only specify one
admin port.
Default [1111]:


The administrative user name and password you provide here is required to use
the Adobe Flash Media Server Management Console for
administration, monitoring, and debugging.

Please enter the administrative username:

Please enter the administrative password:
Confirm password:


When the Adobe Flash Media Server service is started, the service
can be run as a user other than "root". The server would change to this user
when the server is started and has acquired its ports.

Please enter the user that the Adobe Flash Media Server service will run as
Default user [nobody]:

Please enter a valid user group for the "nobody" user: Default group [nobody]:


Do you want to install apache? (y/n)
Default [y]: n



Do you want the Adobe Flash Media Server service to run as a
daemon? (y/n)
Default [y]:


Do you want to start the Adobe Flash Media Server
after the installation is done? (y/n)
Default [y]:


----------- Install Action Summary -----------

Installation directory = /opt/adobe/fms

Flash Media Server Port = 1935,80
Flash Media Admin Server Port = 1111


Administrative username = xxxxxx
Administrative password = (suppressed)

service owner = nobody

service user = nobody
service group = nobody

Run as daemon = Yes
Start Flash Media Server = Yes

Proceed with the installation? (y/n/q): y

Installing Adobe Flash Media Server files...

Configuring Adobe Flash Media Server...
Adding "fms" service.
Setting default admin to "fms".
Setting autostart for "fms".
Server:fms command:start
NPTL 2.5
Starting Adobe Flash Media Server (please check /var/log/messages)

Admin server:fmsadmin command:start
Starting Adobe Flash Media Admin Server (please check /var/log/messages)


The Adobe Flash Media Server installation is complete.

2010/09/05

[Repository - CentOS-Extras,CentOS-Testing]

# rpm --import http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
# vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo
[kbs-CentOS-Extras]
name=CentOS.Karan.Org-EL$releasever - Stable
gpgcheck=1
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=0
baseurl=http://centos.karan.org/el$releasever/extras/stable/$basearch/RPMS/
[kbs-CentOS-Testing]
name=CentOS.Karan.Org-EL$releasever - Testing
gpgcheck=1
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=0
baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/

[Repository - DAG]

DAG(rpmforge)

# vi /etc/yum.repos.d/CentOS-Dag.repo
[dag]
name=CentOS-$releasever - Dag
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el$releasever/en/$basearch/dag
http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=0
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

[rhythmbox plugin for mp3]

-->Repository

# yum --enablerepo=dag install gstreamer-plugins-ugly

[USB Flash Mount on Linux]

# dmesg


sda: sda1


# mount -t vfat /dev/sda1 /mnt/flash
# umount /mnt/flash

2010/09/01

[PEAR - HTTP Access]

PHPからHTTPアクセスするために必要なもの

# pear install pager
# pear install HTTP_Request
# pear install Cache
# pear install Cache_Lite

ついでにモバイルのUser-Agentも(β版かも)
# pear install -f Net_UserAgent_Mobile

[PEAR Update]

バージョンが1.36未満の場合は一度バージョンをアップデートを行う
# pear upgrade -a PEAR-1.3.6

最新バージョンにアップデート
# pear upgrade PEAR

各種パッケージもアップデート
# pear upgrade Archive_Tar
# pear upgrade Structures_Graph
# pear upgrade PEAR

チャンネルもアップデート
# pear update-channels pear.php.net