Cut m3u8 under centos 6.5 x64

Source: Internet
Author: User

操作系统:centos 6.5

必需要参考的文章:

http://blog.chinaunix.net/uid-23069658-id-4018842.html

 

准备工作:

安装git

yum install git -y

 安装svn

yum install svn

 

Centos 准备安装删除已安装包

yum erase ffmpeg x264 x264-devel

 

Centos 安装各种依赖包

yum install  gcc gcc-c++ make nasm pkgconfig wget curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel libtool mhash.x86_64 perl-Digest-SHA1.x86_64  pcre.i386 pcre.x86_64 pcre-devel.i386 pcre-devel.x86_64 -y

 

  安装nasm编译器支持汇编优化(lame库需要)

防止因为时间不对,修改一下为北京时间

1.如果提示command not found,那说明ntp没有安装,使用如下命令进行安装 
yum -y install ntpdate ntp 

2、ntpdate us.pool.ntp.org 

3、设置硬件时间和软件时间的一致并校准 
/sbin/hwclock --systoh

wget http://www.nasm.us/pub/nasm/releasebuilds/2.11.05/nasm-2.11.05.tar.bz2tar xvf nasm-2.11.05.tar.bz2cd nasm-2.11.05配置安装目录为/usr/bin:./configure --prefix=/usr编译并安装:make && make install

 

安装yasm编译器支持汇编优化(ffmpeg库需要)wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz解压:tar xvf yasm-1.2.0.tar.gzcd yasm-1.2.0配置安装目录为/usr/bin:./configure --prefix=/usr编译并安装:make && make install

 

安装x264库支持h.264视频转码
安装x264库支持h.264视频转码执行以下命令获取x264的最新源代码git clone git://git.videolan.org/x264.gitcd x264./configure --enable-sharedmake && make install

 安装 LibNut

 安装libnut,该软件需要用svn获取源代码,svn可以直接用yum install svn来装。先下载:# svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut下载后代码保存在新建立的libnut目录下,对于64位Linux需要修改配置文件:# cd libnut# vi config.mak在最后一个CFLAGS下一行增加:CFLAGS += -fPIC然后编译安装:# make # make install
====================================================================================================================================================
安装liboggyum install libogg-devel

安装libtheora (svn获取)
# svn co http://svn.xiph.org/trunk/theora theora# cd theora # ./autogen.sh # ./configure # make # make install

 

安装libvorbis# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz# tar xvfz libvorbis-1.2.0.tar.gz# cd libvorbis-1.2.0 # ./configure # make # make install

 

安装libvpx

++++++++libvpx+++++++++++git clone http://git.chromium.org/webm/libvpx.git (本次获取后打包为libvpx-v1.2.0.tar.gz) 其它获取方式#wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2cd libvpx./configure --enable-sharedmake && make install

 

++++++++Xvid+++++++++++#wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gztar zxf xvidcore-1.3.2.tar.gzcd xvidcore/build/generic./configuremake && make install

 

上面的媒体支持库安装完后,可以设置下环境准备编译ffmpeg了。不过在此之前必须修改环境变量vim /etc/ld.so.conf在文件末增加一行:/usr/local/lib       然后生效之:ldconfig -v

 

 

编译ffmpeg执行以下命令获取ffmpeg源代码git clone git://source.ffmpeg.org/ffmpeg.gitcd ffmpeg./configure  --enable-version3  --enable-libvpx --enable-libfaac --enable-libmp3lame  --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora***需要保证 --enable-libx264能执行make && make installldconfig -vTS流分割器segmenter的安装与使用git clone https://github.com/johnf/m3u8-segmenter
cd m3u8-segmenter
gcc -Wall -g m3u8-segmenter.c -o segmenter -lavformat -lavcodec -lavutilcp segmenter /usr/bin/ 
直接转成ts

ffmpeg -i vp5.flv -acodec copy -vcodec libx264 vp5.ts

150MB的一个MPG文件,大约转换时间:4分零7秒。


切割
segmenter -i vp5.ts -d 10 -p segmenter_test -m vp5.m3u8 -u http://127.0.0.1:8080/Video/ 这样就可以切片出m3u8文件 直接使用hls

在Centos 6.5 X64下切割m3u8

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.