• Install FFMPEG Web Server


    A lot of people are getting hiring people to install FFMPEG as they think it’s a difficult task, but it’s much easier than you think if you follow these instructions. You should have root access & basic Linux knowledge to the server to follow these instructions.

    1. Create a directory to do our work in
    mkdir ~/ffmpeg
    cd ~/ffmpeg

    2. Get all the source files
    wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/ essential-20061022.tar.bz2
    wget http://rubyforge.org/frs/download.php/9225/ flvtool2_1.0.5_rc6.tgz
    wget http://easynews.dl.sourceforge.net/sourceforge/ lame/lame-3.97.tar.gz
    wget http://superb-west.dl.sourceforge.net/sourceforge/ ffmpeg-php/ffmpeg-php-0.5.0.tbz2
    wget http://downloads.xiph.org/releases/ ogg/libogg-1.1.3.tar.gz
    wget http://downloads.xiph.org/releases/ vorbis/libvorbis-1.1.2.tar.gz

    3. Extract all the source files
    bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
    tar zxvf flvtool2_1.0.5_rc6.tgz
    tar zxvf lame-3.97.tar.gz
    bunzip2 ffmpeg-php-0.5.0.tbz2; tar xvf ffmpeg-php-0.5.0.tar
    tar zxvf libogg-1.1.3.tar.gz
    tar zxvf libvorbis-1.1.2.tar.gz

    4. Create the codecs directory & import them
    mkdir /usr/local/lib/codecs/
    mv /essential-20061022/* /usr/local/lib/codecs/
    chmod -R 755 /usr/local/lib/codecs/

    5. Install SVN/Ruby (Depends on OS, this is for RHEL/CentOS)
    yum install subversion
    yum install ruby
    yum install ncurses-devel

    6. Get the latest FFMPEG/MPlayer from the subversion
    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
    svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

    7. Compile LAME
    cd ~/ffmpeg/lame-3.97
    ./configure
    make
    make install

    8. Compile libOGG
    cd ~/ffmpeg/libogg-1.1.3
    ./configure
    make
    make install

    9. Compile libVorbis
    cd ~/ffmpeg/libvorbis-1.1.2
    ./configure
    make
    make install

    10. Compile flvtool2
    cd ~/ffmpeg/flvtool2_1.0.5_rc6
    ruby setup.rb config
    ruby setup.rb setup
    ruby setup.rb install

    11. Compile MPlayer
    cd ~/ffmpeg/mplayer
    ./configure
    make
    make install

    12. Compile FFMPEG
    cd ~/ffmpeg/ffmpeg
    ./configure --enable-mp3lame --enable-libogg --enable-vorbis --disable-mmx --enable-shared
    echo '#define HAVE_LRINTF 1' >> config.h
    make
    make install

    13. Finalize the codec setups
    ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
    ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
    ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
    ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
    ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

    14. Compile FFMPEG-PHP
    cd ~/ffmpeg/ ffmpeg-php-0.5.0
    phpize
    ./configure
    make
    make install

    15. Install FFMPEG-PHP (make sure the php.ini path is correct.)
    echo 'extension=/usr/local/lib/php/extensions/ no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini

    16. Restart Apache to load FFMPEG-PHP (Depends on OS, this is for RHEL/CentOS)
    service httpd restart

    17. Verify if it works
    php -r 'phpinfo();' | grep ffmpeg

    If you get a few lines such as
    ffmpeg
    ffmpeg support (ffmpeg-php) => enabled
    ffmpeg-php version => 0.5.0
    ffmpeg.allow_persistent => 0 => 0

    Then everything is installed and working. FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG.

    Cara lain

    Instruction.
    Anything that I want you to type in shell will be written inbetween [ these ]
    Open install.php on your personal computer, with notepad or your php editor.
    Press cTRL + A to select all the text, then press CTRL + C to copy the text
    into the clipboard buffer.
    Login to your shell, with putty, carry out the following steps for execution
    [ cd / ]
    [ vi install.php ]
    press [ i ]
    NOTE : You should now have vi open with --INSERT-- written at the bottom of the
    screen
    Hover over putty with your mouse and press the right mouse key to paste all the
    text into the vi document.
    Press the ESCAPE ( esc ) key once, then
    type [ :wq ] and press enter.
    then [ php install.php ] and press enter, if all goes to plan your done, you'll
    be told where the library is - you should probably copy it to somewhere simpler
    to remember, like your /home directory.
    If you have any problem, please report it to http://krakjoe.com/bug/ffmpeg-installer

    /** v2
    ffmpeg-installer is a php script intended for server administrators ( root ) to
    download, configure, and install lame, ffmpeg, and ffmpeg-php
    **/
    # Location to do all the building and downloading to
    define("MAIN_BASE", "/usr/src/ffmpeg-installer");
    # Install prefix
    define("MAIN_PREFIX", "/usr"); 
    # Lame MP3 Codec version
    define("LAME_VERSION", "3.97"); 
    # ffmpeg-php Version
    define("FFMPEG_PHP_VERSION", "0.5.0"); 
    # ffmpeg sources, use checkout-snapshot
    define("FFMPEG_SOURCE", "http://ffmpeg.mplayerhq.hu/ffmpeg-checkout-snapshot.tar.bz2");
    /**
    Stop editing this file now, upload it to your server and execute it as root
    **/
    class main
    {
    function main( )
    {
    @exec( sprintf( "rm -rf %s", MAIN_BASE ), $return );
    if( !@chdir( MAIN_BASE ) and !@mkdir( MAIN_BASE ) ) $this->xit( sprintf( "Cannot change toor create %s", MAIN_BASE ) );
    $this->toConsole( "We'll start by downloading lame sources");
    if( !$this->download( sprintf("http://kent.dl.sourceforge.net/sourceforge/lame/lame-%s.tar.gz", LAME_VERSION ), "lame-source.tar.gz" ) ):
    $this->xit( sprintf( "Cannot download lame-%s from default mirror, try the default 3.9.7", LAME_VERSION ) );
    else:
    $this->toConsole( "Downloaded lame sources, about to unpack" );
    $this->_unpack( "lame-source.tar.gz" );
    if( !chdir( sprintf( "lame-%s", LAME_VERSION ) ) ) $this->xit( "Cannot change to lame sources directory" );
    $this->toConsole( "Unpacked lame sources, about to compile" );
    exec( sprintf( "./configure --prefix=%s && make && make install", MAIN_PREFIX ) );
    if( !$this->is_installed( "lame" ) ) $this->xit( "Lame failed to install" );
    $this->toConsole( "Lame installed, about to download ffmpeg");
    chdir( MAIN_BASE );
    if( !$this->download( FFMPEG_SOURCE, basename( FFMPEG_SOURCE ) ) ):
    $this->xit( "Cannot download ffmpeg sources" );
    else:
    $this->toConsole( "Downloaded ffmpeg sources about to unpack" );
    $this->_unpack( basename( FFMPEG_SOURCE ), "xjf" );
    exec( sprintf( "mv ffmpeg-checkout-%s* ffmpeg-sources", date( "Y-m" ) ) );
    if( !chdir( "ffmpeg-sources" ) ):
    $this->xit( "Cannot change to ffmpeg sources directory");
    else:
    $this->toConsole( "Unpacked ffmpeg sources, about to compile" );
    putenv( sprintf( "TMPDIR=%s", MAIN_BASE . "/temp" ) );
    mkdir( MAIN_BASE . "/temp" );
    exec( sprintf( "./configure --prefix=%s --cross-compile --enable-libmp3lame --enable-shared && make && make install", MAIN_PREFIX ) );
    if( !$this->is_installed("ffmpeg") ) :
    $this->xit( "ffmpeg failed to install" );
    else:
    $this->toConsole( "ffmpeg installed, about to download ffmpeg-php");
    chdir( MAIN_BASE );
    $sources = sprintf("http://kent.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-%s.tbz2", FFMPEG_PHP_VERSION );
    if( !$this->download( $sources, basename( $sources ) ) ):
    $this->xit( "Cannot download $sources" );
    else:
    $this->toConsole( "ffmpeg-php downloaded, about to unpack" );
    $this->_unpack( basename( $sources ), "xjf" );
    if( !chdir( sprintf("ffmpeg-php-%s", FFMPEG_PHP_VERSION ) ) ):
    $this->xit( sprintf("Cannot change to ffmpeg-php-%s", FFMPEG_PHP_VERSION ) );
    else:
    $this->toConsole( "ffmpeg-php unpacked, about to compile" );
    passthru( "phpize" );
    exec( "./configure && make", $return );
    passthru( "make install" );
    $this->toConsole( "All complete, extension location on line above" );
    exec( sprintf( "rm -rf %s", MAIN_BASE ) );
    endif;
    endif;
    endif;
    endif;
    endif;
    endif;

    function download( $source, $destination )
    {
    $written = null;
    $read = fopen( $source, "r" );
    if( !$read ) $this->xit( "Error : Cannot open $source" );
    $write = fopen( $destination, "wb" );
    if( !$write ) $this->xit( "Error : Cannot open $destination");
    while( !feof( $read ) ):
    $written += fwrite( $write, fread( $read, 1024 ) );
    endwhile;
    fclose( $read ); fclose( $write );
    return $written;
    }
    function _unpack( $archive, $format = "xzf" )
    {
    passthru( "tar $format $archive" ); 
    unlink( $archive ); 
    }
    function toConsole( $message ){ return printf( "%srn", $message ); }
    function xit( $message ) { exec( sprintf("rm -rf %s", MAIN_BASE) ); die( sprintf( "Error : %srn", $message ) ); }
    function is_installed( $program ) { exec( "which $program", $return ); return $return[0]; }

    }
    $main = new main( );
    ?>

  • 相关阅读:
    Linux 安装 MysQl
    Linux上安装pip以及setuptools
    Linux 安装 python3
    基础 项目部署 上线
    wepsocket 了解一下
    scrapy之中间件
    scrapy之定制命令
    网络爬虫之scrapy框架设置代理
    爬虫之Xpath详解
    3.8软件测试模型
  • 原文地址:https://www.cnblogs.com/top5/p/1930303.html
Copyright © 2020-2023  润新知