欢迎各位兄弟 发布技术文章
这里的技术是共享的
目前PHP里做视频截图的相关文章太少了,不知道有谁会这方面的知识,请给个帮助! 没有办法自己找了些资料!还在看中ing。。。。。。。。。。。。。。。。。。。 FFMPEG 和 FFMPEG-PHP 的安装 [编辑] 软件下载FFmpeg 官方主页: http://ffmpeg.sourceforge.net cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg FFmpeg-php 官方主页 http://ffmpeg-php.sourceforge.net cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ffmpeg-php login cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ffmpeg-php co ffmpeg-php Lame 下载地址:http:// www.linuxpackages.net/sea ... ;name=lame&ver= Apache v2.0.54 官方主页: http://www.apache.org http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz PHP v4.3.11 官方主页: http://www.php.net http://cn.php.net/distributions/php-5.0.4.tar.gz GD Library v2.0.33 官方主页: http://www.boutell.com/gd/ http://www.boutell.com/gd/http/gd-2.0.33.tar.gz FreeType v2.1.10 官方主页: http://www.freetype.org http:// savannah.nongnu.org/downl ... etype-2.1.10.tar.gz Jpeg v6b 官方主页: http://www.ijg.org http://www.ijg.org/files/jpegsrc.v6b.tar.gz LibPNG v1.2.8 官方主页: http://sourceforge.net/project/showfiles.php?group_id=5624 http:// voxel.dl.sourceforge.net/ ... 1.2.8-config.tar.gz zlib v1.2.2 官方主页: http://www.gzip.org/zlib/ http://www.zlib.net/zlib-1.2.2.tar.gz [编辑] 开始安装
for i in `ls *.gz`;do tar zxvf $i; done; for i in `ls *.bz2`;do tar jxvf $i; done;
##### ffmpeg #####cd ffmpeg./configure --prefix=/usr/local --enable-memalign-hack --enable-mp3lame --enable-sharedmakemake installcd..cp -r /usr/local/lib/libav*.so /usr/lib注:--prefix=/usr/local不得修改,否则ffmpeg-php安装不上运行/usr/local/bin/ffmpeg –v测试是否安装成功 ##### Apache2 #####cd httpd-2.0.54./configure --enable-so --prefix=/server/httpd --with-config-file-path=/server/httpd/confmakemake installcd .. 注:运行/server/httpd/bin/httpd –k start http://192.168.1.xxx测试是否安装成功测试完后要关闭/server/httpd/bin/httpd –k stop ##### FreeType #####cd freetype-2.1.10./configure --prefix=/usr/local/freetypemakemake installcd .. ##### LibPNG #####cd libpng-1.2.8./configure --prefix=/usr/local/libpng --enable-shared --enable-staticmake testmake installcd .. ##### Jpeg #####cd jpeg-6bmkdir /usr/local/jpegmkdir /usr/local/jpeg/binmkdir /usr/local/jpeg/libmkdir /usr/local/jpeg/includemkdir /usr/local/jpeg/manmkdir /usr/local/jpeg/man/man1./configure --prefix=/usr/local/jpeg --enable-shared --enable-staticmakemake installcd .. ##### zlib #####cd zlib-1.2.2./configuremakemake installcd .. ##### GD Library #####cd gd-2.0.33./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png --with-zlibmakemake installcd .. ##### ffmpeg-php #####按照官方的说法,可以在装php前安装ffmpeg-php但是我没成功运行不了phpize因此此步在装了php后再进行有点傻 ##### PHP #####cd php-4.3.11./configure --prefix=/server/php --with-apxs2=/server/httpd/bin/apxs --with-gd=/usr/local/gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png --with-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-config-file-path=/server/httpd/confmakemake installcp php.ini-dist /server/httpd/conf/php.inicd .. ##### ffmpeg-php #####mv ffmpeg-php /path/to/php_sources/ext/ffmpegcd /path/to/php_sourcesautoconf./configure --prefix=/server/php --with-apxs2=/server/httpd/bin/apxs --with-gd=/usr/local/gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png --with-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-config- file-path=/server/httpd/conf --with-ffmpeg=/user/local/includemakemake install
./configure --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-freetype --without-gdbm --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-png --enable-ftp --enable-sockets -with-xml --with-dom --with-zlib --enable-track-vars --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-ffmpeg=/user/local/includemake && make install加粗为需要注意的地方,路径或参数不同会造成无法加载ffmpeg.so的错误.错误提示如:Warning: dl(): Not supported in multithreaded Web servers - use extension statements in your php.ini加粗为需要注意的地方,路径或参数不同会造成无法加载ffmpeg.so的错误.错误提示如:Warning: dl(): Not supported in multithreaded Web servers - use extension statements in your php.ini有关该问题的讨论帖可参考ffmpeg工程组论坛中的相关讨论: FFMPEG 和 FFMPEG-PHP 的安装[编辑] 获取ffmpeg源代码 This tutorial is about transcoding video fom one codec into another using FFMPEG. I got deeper into FFMPEG when I wanted to transcode into FLV (Flash Video) and it works very well. I developed the Riva FLV Encoder, a GUI for FFMPEG. Update 26.10.2006: This tutorial is a little outdated as there were many changes in FFMPEG like the switch from CVS to Subversion and the workflow to compile FFMPEG under Windows has become more difficult. For the new tweaks check this tutorial.
MSYS是什么,他与CYGWIN有什么区别? [编辑] Use FFMPEG Copy your compiled ffmpeg.exe from your MSYS directory to the directory where you like to transcode with ffmpeg Open the Dos-Shell and change to the directory where you copied the ffmpeg.exe Copy a test.mpg into your directory and enter the following command: ffmpeg -i test.mpg -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 test.flvYour first FLV should be encoded now [编辑] Render Images from a Video Enter command: ffmpeg -an -y -t 0:0:0.001 -i test.flv -f image2 test%d.jpgHINT: With -t you set the length of images to be extracted. Above we entered 1 millisecond the extract one image. If you miss this parameter all images of the video will be extracted [编辑] ZLib Support (e.g. for TSCC and Quicktime codecs). This should be compiled into FFMPEG. It is not an explicit compile in the configure statement. Do the following steps and after configure you should see that zlib is "on". Download and compile ZLib Extract the files to your mysys directory Change the directory in MSYS to that directory Enter command ./confuguremakemake install.[编辑] AC3 Support Add "--enable-a52 --enable-gpl" to your configure command [编辑] 3GP Support If you want to enable 3GP support you have to add the AMR audio codec. Download the TS26.104 REL-5 V5.1.0 26104-5??.zip here. Extract the codec into libavcodec/amr_float and add "--enable-amr_nb" to your configure command [编辑] XVID Support (thanks to garvin.thornten at datel.co.uk) Download and install the codec from www.xlib.org (see xvidcore-xxxx/doc/install). Add "--enable-xvid --enable-gpl" to your configure command. When compiling with xvid codec in MinGW or cygwin you will get a "mkstemp" error when compiling "xvidff.c". To fix this edit "libavcodec/xvidff.c" and add the following after the #includes. This will probably be fixed in a future ffmpeg release: ´ /* Added for windows compile ----------------- */#include int xvid_ff_2pass(void *ref, int opt, void *p1, void *p2); void xvid_correct_framerate(AVCodecContext *avctx); int mkstemp(char* template)char temppath[512];if(GetTempPath(512,temppath)!=0){ if(GetTempFileName(temppath,"fil",0,template)!=0) { FILE *pFile; pFile=fopen(template,"w+"); if(pFile!=NULL) return (int)pFile; }} return -1;}/* ------------------------------------------- */ |