2013年12月16日 星期一

CentOS 6 安裝 ClipBucket 2.6


安裝必要套件
yum install httpd httpd-devel mysql-server php php-mysql ffmpeg flvtool2 zlib-devel zlib mplayer mod_flvx


# 安裝MP4Box
wget http://downloads.sourceforge.net/gpac/gpac_extra_libs-0.4.5.tar.gz
wget http://downloads.sourceforge.net/gpac/gpac-0.4.5.tar.gz
tar -zxvf gpac-0.4.5.tar.gz
tar -zxvf gpac_extra_libs-0.4.5.tar.gz
cd gpac
cp -r ../gpac_extra_libs/* extra_lib/
./configure
make lib
make apps
make install
cp bin/gcc/libgpac.so /usr/lib
ldconfig
cp /usr/local/bin/MP4* /usr/bin/





# vi /etc/init.d/php.ini
max_execution_time = 300
max_input_time = 600
memory_limit = 512M
post_max_size =1024M
upload_max_filesize=1024M
short_open_tag = On #開啟這項才能看到 ClipBucket安裝畫面
date.timezone = "Asia/Taipei"


# 讓 Apache支援mp4串流
wget http://h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf apache_mod_h264_streaming-*.tar.gz
cd mod_h264_streaming-*
./configure --with-apxs=/usr/local/apache/bin/apxs
make
make install

# vi /etc/httpd/conf/httpd.conf
LoadModule h264_streaming_module modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4



# 安裝 ClipBucke
wget http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.6-r738-security-fixed.zip
unzip clipbucket-2.6-r738-security-fixed.zip
mv clipbucket-2.6-r738-security-fixed/upload/* /var/www/html

# 修改目錄權限
cd /var/www/html
chmod 777 includes
chmod 777 files
chmod 777 files/conversion_queue
chmod 777 files/logs
chmod 777 files/original
chmod 777 files/temp
chmod 777 files/thumbs
chmod 777 files/photos
chmod 777 files/videos
chmod 777 files/mass_uploads
chmod 777 files/temp/install.me
chmod 777 images
chmod 777 images/avatars
chmod 777 images/backgrounds
chmod 777 images/collection_thumbs
chmod 777 images/category_thumbs
chmod 777 images/groups_thumbs
chmod 777 includes/langs/
chmod 777 includes/langs/en.lang
chmod 777 cache
chmod 777 cache/comments
chmod 777 cache/userfeeds





低畫質轉檔時也使用多執行緒
# vi includes/classes/conversion/ffmpeg.class.php
$opt_av .= " -s {$width}x{$height} -aspect $ratio -padcolor 000000 -padtop $pad_top -padbottom $pad_bottom -padleft $pad_left -padright $pad_right -threads 0 ";


下載中文語系檔,來源為 系統很茫
http://dinno.blog.phc.edu.tw/50/clipbucket-%E7%B9%81%E9%AB%94%E4%B8%AD%E6%96%87%E8%AA%9E%E8%A8%80%E4%B8%8B%E8%BC%89/


設定 ClipBucket

Stats And Configurations
> Website Configurations
> Uploading and Conversion Settings
> FFMPEG Path:/usr/bin/ffmpeg
> MP4Box Path:/usr/bin/MP4Box
> Flvtool2 Path:/usr/bin/flvtool2
> Mplayer Path:/usr/bin/mplayer

> Server Friendly Conversion:打勾
> Max Video Processes at once:1
> Max time wait after max processes:

> Allowed extensions:若有上傳的影片附檔名不在此列,在此加入

> Language Settings
> Browse ClipBucket Language File:上傳語系檔,然後將語系選為繁體中文

Templates And Players
> Player Settings
> Use PseudoStreaming:Yes #開啟後可從尚未下載到的部分開始觀看



常見問題
Q:上傳影片後,一直沒有轉換完成?
A:檢查 FFMPEG、MP4Box、Flvtool2、Mplayer 的程式路徑是否正確。

Q:轉檔工作已經設定一次只轉一個檔,上傳幾個小時後看卻同時都在轉檔了?
A:修改 Max time wait after max processes,此參數為影片上傳後的等待時間。

Q:上傳中文語系檔並選擇繁體中文後,畫面就亂掉了?
A:檢查 includes/langs 目錄是否開放寫入權限,然後將中文語系檔重新上傳一次。

Q:上傳 2G 的影片,明明已修改過 php.ini 卻還顯示,The uploaded file exceeds the upload_max_filesize directive in php.ini
A:建議用 FTP 或 Samba 上傳至 mass_uploads 目錄後再用從 Web 加入影片,因為 php 預設無法處理超過2G以上的檔案,除非重新編譯 php 並加上 -D_FILE_OFFSET_BITS=64 的參數。