태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.
페이지를 읽고 있습니다. ( 아쿠아바다's Blog )
분류 전체보기 (769)
쉐어포인트 (24)
Exchange (12)
SQL (121)
XML (36)
WEB (294)
O / S (97)
삶의향기 (162)
기획 (19)
RSS 피드(IE 7.0부터 기본 지원됩니다. 이전 버전 사용자는 접합한 툴을 사용하세요!!)

동영상 to FLV

O / S/Linux 2007/06/07 16:57 by 아쿠아바다

http://blog.naver.com/iyounwe/140038438134

One-stop Installation Guide for Create a Linux Server-side FLV conversion environment


http://flowplayer.sourceforge.net/index.html


If you want to convert other video format to FLV (sorenson codec), everybody will suggest using FFmpeg. In fact, only FFmpeg is not enough for successfully create a server-side command line conversion environment to create FLV with video and audio, plus the FLV 1.1 metadata information. I have stroked for a whole day to setup my Linux server (Fedora Core 3), so I wrote down my note here for other people and myself as a reference.

Purely install FFmpeg is not enough, the FLV converted has no audio, because FLV audio codec is mp3, so you need LAME support. Moreover, the FLV converted has no metadata, you cannot know the dimension, duration such important information for a FLV player swf. Therefore, you need another free tool: FLVTool2, which is written in Ruby, so I have to install Ruby in my server, too.

Overall installation order: LAME->FFmpeg->Ruby->FLVTool2, if you want to access video info through FFmpeg in php, you can install ffmpeg-php, too.

Please login as root first:

Install LAME
Download from LAME site, type the following command to compile and install it:

./configure --enable-shared --prefix=/usr
make
make install

enable-shared to make sure FFmpeg can use LAME later. Type lame in command line to see help after install succeed.

Note: you can also use yum to install FFmpeg, it will install dependency LAME, too, so you can skip this step.

yum install ffmpeg

Install FFmpeg
Download from FFmpeg site through CVS, type the following command to get the latest copies from CVS and save to your $home (currenly path after login into consule) with folder name "ffmpeg":

cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg

To compile and install it, type the following command:

./configure --enable-gpl --enable-mp3lame --enable-shared --prefix=/usr
make clean && make
make install

enable-shared to make sure ffmpeg-php can use FFmpeg later (if you do not use ffmpeg-php, you do not need --enable-shared --prefix=/usr). Type ffmpeg in command line to see help after install succeed.

Note: you can also use yum to install FFmpeg:

yum install ffmpeg

Install Ruby
Download from Ruby site, type the following command to compile and install it:

./configure
make
make install

Install FLVTool2
Download from FLVTool2 site, type the following command to compile and install it:

ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install

Type flvtool2 in command line to see help after install succeed.


Installation is completed here. If you want to access video infomation easily in php, there is a ffmpeg-php you can try. You can follow the instruction inside the package to install it. I installed it as a Shared Extension and did not edit php.ini to add

extension=ffmpeg.so

When I try its test_ffmpeg.php to verfiy the installation. I saw an error:

Unable to load dynamic library './ffmpeg.so' - ./ffmpeg.so: cannot open shared object file: No such file or directory

You have to copy ffmpeg.so to your php extension folder, or like me, I just copy the file to the same folder of the php script is located.

Follow up

Other Reference







SourceForge project page:
http://sourceforge.net/projects/ffmpeg-php/
Google ffmpeg-php discussion group:
http://groups.google.com/group/ffmpeg-php
Downloads:
http://sourceforge.net/project/showfiles.php?group_id=122353&package_id=133626
Documentation:
API Docs
Browse SVN:
http://svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/
Anonymous SVN:
  1. svn co https://svn.sourceforge.net/svnroot/ffmpeg-php/trunk/ffmpeg-php

Description

ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)

News

05/24/07 - Ffmpeg and ffmpeg-php installation services available. For $75 USD (via Paypal) I will install ffmpeg and ffmpeg on your Linux server. Email ffmpeg.php@gmail.com for more info.

08/15/06 - The ffmpeg-php sources have been migrated from CVS to Subversion. CVS is still available from the command line but will no longer be updated.

08/10/06 - The first alpha build of the rmovie extension for Ruby has been released. rmovie is basically a port of ffmpeg-php to the Ruby language. Check it out at rmovie.rubyforge.org.

09/10/05 - The ffmpeg-php ebuild has been added to Gentoo PHP Overlay. Hopefully it will be included in Portage sometime soon.

Requirements

  • ffmpeg-0.4.9_pre1 or higher.
  • php-4.3.0 or higher
  • gd-2.0 or higher (the version of GD bundled with PHP works too)

Compatibility

Some users have posted Windows builds to the ffmpeg-php google group. I hear from folks that they work great but I haven't had time to test them personally yet.

Apparently there is some sort of conflict between the php IMAP extension and ffmpeg-php in certain cases. The IMAP extension seems to conflict with a few other extensions so for now I am assuming it is a problem with IMAP.

Features

  • Simple object oriented interface.
  • Ability to grab frames from movie files and return them as images that can be manipulated using PHP's built-in image functions. This is great for automatically creating thumbnails for movie files.
  • Can create animated GIFs from a series of movie frames or GD images.
  • Has the ability to use ffmpeg's excellent re-sampling and cropping features on returned frames.
  • Provides access to data from mp3 files such as duration, bit rate and track meta information.

Sites Using ffmpeg-php

Here's a list of some of my favorite sites using ffmpeg-php.

  • Vimeo.com - Vimeo.com is a super cool site for organizing and sharing video clips. Think del.icio.us meets Flickr for video! ffmpeg-php is used for automatic thumbnailing of movies uploaded to the site. Thanks to Vimeo's creator, Jakob Lodwick for the link and encouragement!
  • Trainorders.com - Trainorders is a popular rail enthusiast website with some unique features. My favorite is the new motion activated camera systems that automatically record passing trains at various popular rail junctions. Once recording is complete, the movies are uploaded to the Trainorders.com website where they are thumbnailed using ffmpeg-php and presented to subscribers. A big thanks to Todd Clark, the webmaster of Trainorders.com, for the opportunity to help develop this.
  • patricksaviation.com - This is my son's favorite site on the internet. It's a video sharing website for aviation enthusiasts. Fun! If there's a better use for the internet, I haven't found it.
  • half-lime.com - An excellent video sharing website with a great interface. Thanks to Aleksander Kuprikov for the link.
  • filelabs.net - A free file storage service.
  • www.mobiletoones.com - Rock your mobile phone!

If you have a site to add to the list, shoot me an email at ffmpeg[dot]php[at]gmail[dot]com

Installation

These instructions are for Linux since I don't know the first thing about Windows and I am unable to pry the Mac away from my son since he got an iPod for Christmas.

Building into the PHP binary
Unpack the archive and copy the ffmpeg-php extension directory into your the PHP sources extensions directory.
  1. tar -xjf ffmpeg-php-X.x.x.tar.gz
  2. cp ffmpeg-php /path/to/php_sources/ext
Run autoconf in your php source directory to update the configure script.
  1. cd /path/to/php_sources
  2. autoconf
Configure PHP with the ffmpeg option.
  1. ./configure [other options...] --with-ffmpeg=yes
Now build and install PHP. If everything went as planned, ffmpeg-php is now built into the PHP binary and no further configuration is required.
Building as an Extension
Build and install PHP if it is not already installed
Unpack the archive
  1. tar -xjf ffmpeg-php.X.x.x.tar.gz
Change to the ffmpeg-php extension directory and run phpize (included with your PHP installation) to build configuration files.
  1. cd ffmpeg-php
  2. phpize
Configure and build the extension.
  1. ./configure && make
Install the shared extension.
  1. make install (as root)
If everything went as planned, ffmpeg-php is now installed as a shared extension.
Building with the Gentoo ebuild

Specific instructions can be found at the beginning of the ffmpeg-php-X.x.x.ebuild file. More general information can be found in HOWTO Installing 3rd Party Ebuilds

Configuration

If you've built ffmpeg-php as a shared extension but want to make it available to all scripts by default, add extension=ffmpeg.so to your php.ini file to load ffmpeg-php at PHP startup.

Testing the Installation

  • Put the directory test_media and test_ffmpeg.php script (located in the ffmpeg-php/tests directory) under your web root somewhere (put both in the same directory).
  • Load test_ffmpeg.php into your browser.

RESULTS: You should get a listing of the methods provided by the ffmpeg-php module as well as some test output from the methods.

Usage

If you've the installed ffmpeg-php extension as a shared library but haven't set it to auto-load in your php.ini file, you'll need to use the PHP dl() function to make ffmpeg-php available to your scripts. Add the following PHP code to the beginning of scripts you want to call ffmpeg-php methods in.


<?php
$extension
= "ffmpeg"
;
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX
;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname
;

// load extension
if(!extension_loaded($extension
)) {
   
dl($extension_soname) or die("Can't load extension $extension_fullname\n"
);
}
?>

Documentation

API Documentation

FAQ

Q: How come it doesn't work with some Quicktime movies?

A: Use the latest release of ffmpeg-php and the lastest cvs version of ffmpeg. ffmpeg must be compiled with zlib support to read Quicktime movies with compressed headers.

Q: How come it doesn't work with <myfavoritetype> movies?

A: The ffmpeg-php extension uses ffmpeg libraries for access to video info. Some movie types have limited support in ffmpeg. Some encoders create non-standard movies which may problems for ffmpeg. If the movie can't be read correctly by ffmpeg then it won't work with ffmpeg-php. Consult the ffmpeg documentation for more info on supported formats. If ffmpeg-php won't read a movie, try using the ffmpeg command line program to convert the movie to another type. If it fails, then ffmpeg (and thus ffmpeg-php) don't support your movie type. If ffmpeg converts it correctly then the problem is most likely in ffmpeg-php, in which case you can bug me about it.

Q: ffmpeg-php doesn't do the one freakin' thing I absolutely need! Can you add it to the program?

I'm glad you asked that. First some background. ffmpeg-php was written specifically for a project I was working on and have now finished (Allah be praised!). There is no roadmap for this thing, no big master plan, no wall sized Gannt charts updated hourly by interns. In fact, there's no ongoing development at all beyond just keeping it compatible with the ever changing ffmpeg API (and even then I just wait for someone to complain). That said, I am available for hire if you need further development or customization as long as the resulting code is made open source also.

Q: I can't get it to install. What's the deal?

ffmpeg-php can sometimes be a pain to install. This is mostly due to the strange voodoo it has to do to detect if GD is available in PHP. Sometimes this fails for no apparent reason. Add to that the dependance on ffmpeg cvs and it can get even more tricky. If you get stuck, ask on the Google group and someone can probably talk you through it. If you get really stuck I'd be happy to install ffmpeg and ffmpeg-php (and any other videoshare prerequisites) on your server for $75 bucks. I'll need ssh root access to the machine and about 30 minutes. (Linux only, I'm not a Windows dude)


One-stop Installation Guide for Create a Linux Server-side FLV conversion environment

전체 설치 순서는 LAME->ffmpeg->ruby->flvtool2

관련 명령어 모음>>

관련 참고자료

  • Video and Audio Streaming with Flash and Open Source Tools
  • libflv - creating FLV video streams
  • FLV2MP3 (Make FlashCom recorded FLV conversion possible ?!
  • Flash 视频(FLV)编码,转换,录制,播放方案一网打尽
  • 幾套各種影片轉FLV影音檔工具
  • 'O / S > Linux' 카테고리의 다른 글

    유용한 오픈소스 url 모음  (0) 2007/06/07
    Video Blogging using Django and Flash(tm) Video (FLV)  (0) 2007/06/07
    동영상 to FLV  (0) 2007/06/07
    voip GNUGK 셋업 0508.25  (0) 2007/06/07
    awstats 의 webmin 모듈첨부  (0) 2007/06/01
    qmail-1.03설치 + courier-imap  (0) 2007/06/01
    좀더 흥미로운 내용이 많이 있습니다.. HOME > O / S/Linux를 확인하세요
    TAG ,   
    0 Trackback, 0 Comment, :
    1  ... 363 364 365 366 367 368 369 370 371  ... 769 
    Statistics Graph
    Total : 557,403 Today : 33