1.更新ubuntu源
1 | sudo apt-get update |
2.安装必要lib
1 | sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev |
1 | cd ~ |
#3. 卸载系统原有的ffmgeg和x.264,没有则跳过:
1 | apt-get remove ffmpeg x264 |
#4 先安装一些Mplayer编码库(仅限于64位系统):1
2
3
4
5
6
7
8
9
10
11
12wget -c http://www2.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2
tar xvjf essential-amd64-20071007.tar.bz2
mkdir /usr/local/lib/codecs
cp -Rvp essential-amd64-20071007/* /usr/local/lib/codecs/
编辑下面文件
vim /etc/ld.so.conf
添加以下两行到上面的文件里
/usr/lib
/usr/local/lib
#5 再安装依赖库1
sudo apt-get install make automake g++ bzip2 python unzip patch subversion ruby build-essential git-core checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvdpau-dev libvorbis-dev libvpx-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev
#6 安装 x2641
2
3
4
5
6sudo git clone git://git.videolan.org/x264.git
cd x264
sudo ./configure --enable-shared --prefix=/usr/local
sudo make
sudo make install
cd ~/working
#7 安装libvpx:1
2
3
4
5
6
7
8
9cd ~/working
下载 libvpx-1.4.0,
http://download.csdn.net/download/lsc1818/8929949
tar xvjf libvpx-1.4.0.tar.bz2
cd libvpx-1.4.0
sudo ./configure --enable-shared --prefix=/usr/local
make && make install
cd ~/working
#8 安装FFmpeg
1 | cd ~/working |
#9 安装mplayer and mencoder 不必须1
2
3
4
5apt-get install libmp3lame-dev
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer/
./configure
make && make install
#10 安装flvtool2: 不必须1
2sudo apt-get install ruby
gem install flvtool2
#11 查看一下已经安装好的音频和视频编码器 不必须1
2
3
4
5
6sudo apt-get install mencoder
查看所有所支持的音频编码
mencoder -oac help
查看所有所支持的视频编码
mencoder -ovc help
#12 安装配置Nginx:
先安装各种依赖(nginx需要pcre支持,yamdi用来为flv创建关键帧才能随意拖动)1
sudo apt-get install gcc g++ libssl-dev zlib1g-dev libpcre3-dev yamdi
下载所需的nginx模块
第一个是nginx_mod_h264_streaming,让nginx支持flv/mp4流播放
1 | wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz |
#13 设置nginx为系统服务
1 | sudo wget https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx -O /etc/init.d/nginx |
#14 各种配置nginx:
编辑/usr/local/nginx/conf/nginx.conf文件
1 | sudo gedit /usr/local/nginx/conf/nginx.conf |
#15 m3u8切片
1 | git clone https://github.com/johnf/m3u8-segmenter.git |
未解决问题:
1 网页播放m3u8,原计划使用ckplayer 但是一直有错,没有成功
2 据观察,m3u8同样能够下载?