寄來了適合小一的杯架,所以我也迫不及待地學著拓海把水裝到2/3的位置這樣開車。試試看如何不讓水溢出來。
我選擇的路線是半天岩附近的路,不是很長,但有一些高低差的U型彎,而且這裡也是我十年前練手排車的地方,頗讓人回味。
2010年1月31日星期日
2010年1月19日星期二
PHP5的::、->、self、$this的區別
- 如果被引用的變數或者方法被宣告為 const 或者 static,那麼就必須使用運算子::。
- 如果被引用的變數或者方法沒有被宣告為 const 或者 static,那麼就必須使用運算子->。
- 如果從類別內部存取 const 或者 static 變數或者方法,那麼就必須使用自引用的 self。
- 如果從類別內部存取不為 const 或者 static 變數或者方法,那麼就必須使用自引用的 $this。
2009年12月7日星期一
Mencoder + libx264
既上一篇PSP+Mencoder+FFMPEG+X264的搭配版本之後,心有不甘,決定要好好研究一下這三者究竟是那一個出了錯,造成我轉檔失敗。
使用先前的 rip2pmp 版本時,利用 libavcodec 來轉檔時,會出現:
使用先前的 rip2pmp 版本時,利用 libavcodec 來轉檔時,會出現:
videocodec: libavcodec (480x272 fourcc=34363268 [h264]) [libx264 @ 0x957eaf0]broken ffmpeg default settings detected [libx264 @ 0x957eaf0]use an encoding preset (vpre) Could not open codec.
2009年9月22日星期二
PSP+Mencoder+FFMPEG+X264的搭配版本
會寫這一篇文章,主要是因為先前用來轉檔的script,在Debian Squeeze的版本上,使用 debian-multimedia 的版本匹配上出錯,造成無法再轉錄 h264 的影片到 PSP 上了。有鑑於此,還是寫個文件記錄一下好了。
轉錄的工具軟體如下:
mencoder 1:1.0.rc2svn20090823-0.0
libavcodec52 5:0.5+svn20090823-0.0
libx264-68 1:0.svn20090730-0.0
libfaac0 1.28-0.3
以上是 Debian Squeeze 的搭配,很不巧的是目前的 libx264-68 會無法轉錄為 H.264 的檔案,所以我們改用上一個版本:
libx264-67
libx264-dev
安裝後,請再重新編譯一次 mencoder(別忘記裝 libfaac-dev),配合我常用的 rip2pmp,又能正常地轉錄地將影片轉錄成 h.264 的格式了。
參考:
rip2pmp :這是我用來快速轉錄成 H.264 格式的 Script,支援PSP,PS3,IPOD,影片來源只要是mplayer能撥放的,皆可以轉錄。
轉錄的工具軟體如下:
mencoder 1:1.0.rc2svn20090823-0.0
libavcodec52 5:0.5+svn20090823-0.0
libx264-68 1:0.svn20090730-0.0
libfaac0 1.28-0.3
以上是 Debian Squeeze 的搭配,很不巧的是目前的 libx264-68 會無法轉錄為 H.264 的檔案,所以我們改用上一個版本:
libx264-67
libx264-dev
安裝後,請再重新編譯一次 mencoder(別忘記裝 libfaac-dev),配合我常用的 rip2pmp,又能正常地轉錄地將影片轉錄成 h.264 的格式了。
參考:
rip2pmp :這是我用來快速轉錄成 H.264 格式的 Script,支援PSP,PS3,IPOD,影片來源只要是mplayer能撥放的,皆可以轉錄。
2009年8月6日星期四
Grub2 如何加入別的 OS
在 /etc/grub.d/ 目錄下,有一些數字開頭的 script 檔,這些 script 檔會在執行 grub-mkconfig 時依序的執行並加到 grub.cfg 中。
所以當我們要加入一個 OS 項目時,可以這樣實作:
1. 加入一個 WinXP 的項目檔案,
# vim /etc/grub.d/40_winxp
#! /bin/sh -e
echo 」Adding Windows" >&2
cat << EOF
menuentry 「Windows XP」 {
set root=(hd0,1)
chainloader +1
}
EOF
然後再執行,grub-mkconfig,就會加入WinXP的選項。但我並不建議這樣用,太累了。
Debian有更聰明的做法,/etc/grub.d/下有一個30_os_prober的 script,望文生意就能知道它能自動偵測有什麼OS在硬碟裡。
首先,安裝os-prober後,再執行一次 grub-mkconfig,就會發現到 console 有這樣的敘述:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.26-2-686-bigmem
Found initrd image: /boot/initrd.img-2.6.26-2-686-bigmem
Found Microsoft Windows XP Professional on /dev/sda1
這樣就表示已經抓到Windows的磁區了,這樣就不用再煩惱OS開機碟怎麼設定了!
所以當我們要加入一個 OS 項目時,可以這樣實作:
1. 加入一個 WinXP 的項目檔案,
# vim /etc/grub.d/40_winxp
#! /bin/sh -e
echo 」Adding Windows" >&2
cat << EOF
menuentry 「Windows XP」 {
set root=(hd0,1)
chainloader +1
}
EOF
然後再執行,grub-mkconfig,就會加入WinXP的選項。但我並不建議這樣用,太累了。
Debian有更聰明的做法,/etc/grub.d/下有一個30_os_prober的 script,望文生意就能知道它能自動偵測有什麼OS在硬碟裡。
首先,安裝os-prober後,再執行一次 grub-mkconfig,就會發現到 console 有這樣的敘述:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.26-2-686-bigmem
Found initrd image: /boot/initrd.img-2.6.26-2-686-bigmem
Found Microsoft Windows XP Professional on /dev/sda1
這樣就表示已經抓到Windows的磁區了,這樣就不用再煩惱OS開機碟怎麼設定了!
Debian Testing 升級到grub2
今早upgrade的時候,發現debian已建議轉換成 grub2,既然都這樣建議了,當然是把它換掉。
一開始安裝 grub2-pc後,會先相容舊的grub,開機的時候會出現:
When you have verified GRUB 2 works, you can use this command to
complete the upgrade: upgrade-from-grub-legacy
選擇linux-kernel的選項後,再執行 upgrade-from-grub-legacy,就能轉換成功。
設定檔由原本的 menu.lst 變成 /etc/grub.d/ 和 /etc/default/grub,設定完這兩個檔案內容後,執行 /usr/sbin/grub-mkconfig 就能產生 /boot/grub/grub.cfg,也就是開機時的選單了。
配合新版的grub2-splashimage,開機選單真是漂亮!而且,我覺得開機變快!
GRUB 2 has the following tasks:
* Create a compact core image. This will make Stage 1.5 unnecessary.
* Add support for dynamic loading to the core image, so that it can extend itself at the run time rather than at the build time.
* Add real memory management, to make GNU GRUB more extensible.
* Add a more object-oriented framework for file systems, files, devices, drives, terminals, commands, and OS loaders.
* Add support for internationalization. This includes support for non-ASCII character code, message catalogs like gettext, fonts, graphics console, and so on.
* Add an actual localization, based on the above internationalization support. We will target on Japanese as the first step.
* Segregate code specific to i386-pc from generic code, to make GNU GRUB portable.
* Add support for cross-platform installation.
* Develop additional software packages which will help our project and hopefully other projects.
一開始安裝 grub2-pc後,會先相容舊的grub,開機的時候會出現:
When you have verified GRUB 2 works, you can use this command to
complete the upgrade: upgrade-from-grub-legacy
選擇linux-kernel的選項後,再執行 upgrade-from-grub-legacy,就能轉換成功。
設定檔由原本的 menu.lst 變成 /etc/grub.d/ 和 /etc/default/grub,設定完這兩個檔案內容後,執行 /usr/sbin/grub-mkconfig 就能產生 /boot/grub/grub.cfg,也就是開機時的選單了。
配合新版的grub2-splashimage,開機選單真是漂亮!而且,我覺得開機變快!
GRUB 2 has the following tasks:
* Create a compact core image. This will make Stage 1.5 unnecessary.
* Add support for dynamic loading to the core image, so that it can extend itself at the run time rather than at the build time.
* Add real memory management, to make GNU GRUB more extensible.
* Add a more object-oriented framework for file systems, files, devices, drives, terminals, commands, and OS loaders.
* Add support for internationalization. This includes support for non-ASCII character code, message catalogs like gettext, fonts, graphics console, and so on.
* Add an actual localization, based on the above internationalization support. We will target on Japanese as the first step.
* Segregate code specific to i386-pc from generic code, to make GNU GRUB portable.
* Add support for cross-platform installation.
* Develop additional software packages which will help our project and hopefully other projects.
2009年7月3日星期五
體驗multi-thread decode的mplayer
先前閱讀了GeeXbox的 multi-thread decode 的功能,感到非常有興趣,因為我自已有收藏了許多1080p H264的影片,但我的Althon X2 3600+其實撥不太動。看到了Multi-thread decode的功能,當然要好好嘗試,讓我的 CPU 可以播放高清影片。
影片格式必須是 Mpeg1/2 H264才可以,大部份的高清片都以Mpeg2, H264為主,所以不用擔心。
先記錄一下做法。
1. 下載最新的 mplayer:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
2. 下載 FFmpeg-mt:
git clone git://gitorious.org/~astrange/ffmpeg/ffmpeg-mt.git
3. 更新 mplayer 的libav*目錄
cd mplayer
rm -fr libav*
cp -a ../ffmpeg-mt/libavformat .
cp -a ../ffmpeg-mt/libavcodec .
cp -a ../ffmpeg-mt/libavutil .
4. 開始編譯和make
./configure
make
make install
編譯完成後,隨便拿一個測試影片(網路上也有提供高清的試看),執行下列指令來撥放:
mplayer -vc ffh264 -lavdopts threads=[N] movie.mp4 (N代表CPU的核心數)
撥放時用top來看,可以看到 mplayer 的 loading 會超過100%,而且畫面很順,真是開心極了。按照ffmpeg-mt的官方說法,目前除了Atom N330之外,其它雙核以上CPU都可以順暢。
這應該是C/P值最高的高清撥放功能了。
提外話,等我買了Nvidia8系列的顯示放後,再來測試 nvidia-libvdpau 的高清撥放功能。
影片格式必須是 Mpeg1/2 H264才可以,大部份的高清片都以Mpeg2, H264為主,所以不用擔心。
先記錄一下做法。
1. 下載最新的 mplayer:
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
2. 下載 FFmpeg-mt:
git clone git://gitorious.org/~astrange/ffmpeg/ffmpeg-mt.git
3. 更新 mplayer 的libav*目錄
cd mplayer
rm -fr libav*
cp -a ../ffmpeg-mt/libavformat .
cp -a ../ffmpeg-mt/libavcodec .
cp -a ../ffmpeg-mt/libavutil .
4. 開始編譯和make
./configure
make
make install
編譯完成後,隨便拿一個測試影片(網路上也有提供高清的試看),執行下列指令來撥放:
mplayer -vc ffh264 -lavdopts threads=[N] movie.mp4 (N代表CPU的核心數)
撥放時用top來看,可以看到 mplayer 的 loading 會超過100%,而且畫面很順,真是開心極了。按照ffmpeg-mt的官方說法,目前除了Atom N330之外,其它雙核以上CPU都可以順暢。
這應該是C/P值最高的高清撥放功能了。
提外話,等我買了Nvidia8系列的顯示放後,再來測試 nvidia-libvdpau 的高清撥放功能。
訂閱:
文章 (Atom)