zoukankan      html  css  js  c++  java
  • 在Centos 6.5 X64下切割m3u8

    操作系统: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.bz2 tar xvf nasm-2.11.05.tar.bz2 cd 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.gz
    
    cd 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.git
    
    cd x264
    
    ./configure --enable-shared
    
    make && 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
    ====================================================================================================================================================
    安装libogg
    
    yum 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.bz2
    cd libvpx
    ./configure --enable-shared
    make && make install

     

    ++++++++Xvid+++++++++++
    #wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
    tar zxf xvidcore-1.3.2.tar.gz
    cd xvidcore/build/generic
    ./configure
    make && make install
    上面的媒体支持库安装完后,可以设置下环境准备编译ffmpeg了。不过在此之前必须修改环境变量
    
    vim /etc/ld.so.conf
    
    在文件末增加一行:
    
    /usr/local/lib
    
           然后生效之:
    
    ldconfig -v
    编译ffmpeg
    
    执行以下命令获取ffmpeg源代码
    
    git clone git://source.ffmpeg.org/ffmpeg.git
    
    cd 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 install
    
    ldconfig -v
    
    TS流分割器segmenter的安装与使用
    
    git clone https://github.com/johnf/m3u8-segmenter
    cd m3u8-segmenter
    gcc -Wall -g m3u8-segmenter.c -o segmenter -lavformat -lavcodec -lavutil cp 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
  • 相关阅读:
    HGE tutorial04
    HGE tutorial03
    HGE tutorial02 plus
    HGE tutorial02
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
    C 语言实例
  • 原文地址:https://www.cnblogs.com/littlehb/p/3914437.html
Copyright © 2011-2022 走看看