FFMPEG Install for CentOS 5


 FFMPEG Install for CentOS 5



A little while back, I posted a basic install of ffmpeg for CentOS 5. After working with that build over the last month, I found I needed to expand it to include many different video codecs. Because of licensing restrictions, binaries of the build cannot be distributed. However, instructions for a similar build can! I spent several days (or more) researching the packages I would need and I must have combed dozens of blogs to find this information. The build I made strips sound from videos [See update at the end of this post for more information on this subject], this decreases the final file size. If you need sound, you will not want to follow these steps exactly. I also stripped ffserver and ffplay from my build.


These packages were executed in the following order. I cannot say for certain this exact order must be followed, it was the order in which ffmpeg threw the errors. This tutorial assumes you have wget, bzip2, tar and subversion installed on your system. If you do not, please find and install the lastest versions of these utilities for CentOS 5. Additionally, I have allowed all packages to install into their default directories, typically this is /usr/local/[bin | lib]. If at any point during the process of a ‘make’ you run into errors, be sure and run ‘make clean’ before running ‘make’ again. You will either need root access of su access to install ffmpeg. The marker ‘codec:$’ is my prompt, it is merely to indicate separate commands.



Getting Started



codec:$
codec:$ mkdir -p ./tmp/ffmpeg-packages
codec:$ cd ./tmp/ffmpeg-packages


Installing a52



codec:$ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
codec:$ tar -zxf a52dec-0.7.4.tar.gz
codec:$ cd a52dec-0.7.4
codec:$ ./configure –enable-shared=PKGS
codec:$ make && make install
codec:$ cd ..


Installing FAAD2



codec:$ wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
codec:$ tar zxf faad2-2.6.1.tar.gz
codec:$ cd faad2
codec:$ autoreconf -vif
codec:$ ./configure –disable-drm –disable-mpeg4ip
codec:$ make && make install
codec:$ cd ..


Installing FAAC



codec:$ wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
codec:$ tar zxfv faac-1.26.tar.gz
codec:$ cd faac
codec:$ ./bootstrap
codec:$ ./configure –disable-mp4v2
codec:$ make && make install
codec:$ cd ..


Installing LAME



codec:$ wget \
http://superb-east.dl.sourceforge.net/sourceforge/lame/\
lame-3.98b8.tar.gz
codec:$ tar zxfv lame-3.98b8.tar.gz
codec:$ cd lame-3.98b8
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..


Installing yasm


YASM is a modular assembler, it is required by the x264 package.



codec:$ wget \
http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
codec:$ tar zfvx yasm-0.7.0.tar.gz
codec:$ cd yasm-0.7.0
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..


Installing x264
The x264 package is under git revision control, which is much like CVS or SVN. Thankfully, they provide daily tarballs. I grabbed this one:



codec:$ wget \
ftp://ftp.videolan.org:21//pub/videolan/x264/snapshots/\
x264-snapshot-20080513-2245.tar.bz2


I just did a little exploring via an FTP program to find the snapshot I was after. If you are feeling adventurous, download git and try checking out the latest version from their repository.



codec:$ bzip2 -d x264-snapshot-20080513-2245.tar.bz2
codec:$ tar xfv x264-snapshot-20080513-2245.tar
codec:$ cd x264-snapshot-20080513-2245
codec:$ ./configure –enable-mp4-output –enable-shared –enable-pthread
codec:$ make && make install
codec:$ cd ..


Installing Xvid



codec:$ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
codec:$ tar zxfv xvidcore-1.1.3.tar.gz
codec:$ cd xvidcore-1.1.3/build/generic
codec:$ ./configure
codec:$ make && make install
codec:$ cd ../../..


Installing libraw1394



codec:$ wget http://www.linux1394.org/dl/libraw1394-1.3.0.tar.gz
codec:$ tar zxfv libraw1394-1.3.0.tar.gz
codec:$ cd libraw1394-1.3.0
codec:$ ./configure
codec:$ make dev
codec:$ make && make install
codec:$ cd ..


Installing libdc1394


This project requires libraw1394, you must build it first. This project is a little confusing there is both a libdc1394 and a libdc1394-2. I have only installed the former. Visit Sourceforge here. I grabbed the tarball here:



codec:$ wget \
http://superb-west.dl.sourceforge.net/sourceforge/libdc1394/\
libdc1394-1.2.2.tar.gz
codec:$ tar zxfv libdc1394-1.2.2.tar.gz
codec:$ cd libdc1394-1.2.2
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..


Installing ffmpeg


For FFMPEG, you will need to get the latest out of SVN. FFMPEG doesn’t ever make releases. To do so, run:



codec:$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
codec:$ cd ffmpeg



codec:$ ./configure –enable-gpl –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-swscale –enable-avfilter –enable-pthreads –enable-libxvid –enable-libx264 –enable-libmp3lame –enable-libdc1394 –enable-liba52 –enable-libfaac –disable-ffserver –disable-ffplay
codec:$ make
codec:$ make install


It usually takes at least 5 mins for ‘make’ to run, be sure you have a good file before attempting to install. You will need to be sure and run the ldconfig setting if you have to re-compile, otherwise ffmpeg will throw an error that it cannot find library files. Here is a good resource for using ffmpeg.


Post-Installation Actions


After the install in complete, you may need to add the /usr/local/lib directory to your ld.so.config file. Do the following:



codec:$ cd /etc/
codec:$ cd ld.so.conf.d
codec:$ vi ffmpeg.conf


You need to add ‘/usr/local/lib’ [sans-quotes] to this file and save it. Press Esc, :, x to do so in vi. Afterwords you need to run the following from the commandline



codec:$ ldconfig

That’s it, you now have a fairly robust build of ffmpeg that can take almost anything you can throw at it. Sadly, licensing restrictions prevent binaries from being made of the above steps. Happy (video) encoding!


Update: This build doesn’t actually strip sound from videos, I am doing that with a flag when I run ffmpeg, however, it should be noted that all the audio codecs you may find in many common video formats may not be supported in this build of ffmpeg, which is why I am choosing to strip audio entirely from videos.

flv在线录制、视频转换网站开发文档


flv在线录制、视频转换网站开发文档



Mencoder简介:


     Mencoder是Mplayer自带的编码工具(Mplayer是Linux下的播放器,开源,支持几乎所有视频格式的播放,现在有windows和Mac版本)。


Mplayer的获得与配置:


     Mplayer windows版本下载列表:http://www5.mplayerhq.hu/MPlayer/releases/win32/
列表中会有版本发布日期,可以挑选最新的版本,也可以选择old/去下载老的版本,笔者用的是6月份的版本。下载后解压到某个文件夹中即可。


     Codecs下载列表:http://www5.mplayerhq.hu/MPlayer/releases/codecs/
选择windows-all-********.zip(*表示年月日)下载,将zip包中的文件夹下所有文件,包括*.dll、*.acm、*.ax等等全部copy到Mplayer根目录下的codecs文件夹中。


     此时最好把Mplayer.exe所在路径,同时也是Mencoder.exe所在路径添加到环境变量path中。


    现在可以试试用Mplayer播放视频,比如有个视频位于D:\music\APerfectMatch.wmv,那么可以打开一个cmd窗口,输入 mplayer “D:\music\APerfectMatch.wmv”,感受一下来自Linux的播放器吧,可以通过键盘来操纵。


Mencoder转换视频格式:


     以将各种格式转换为flv格式为例(flv格式是flash支持的视频格式):


mencoder ””E:\test.m2p”” -o ””E:\output.flv”” -of lavf  -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=512:-3 -ofps 12 -srate 22050


     在命令行中输入这行代码(注意:windows的命令行是不支持换行的),按回车运行,一段时间之后就可以得到一个.flv文件,播放一下看看品质如何(可以直接用Mplayer播放)。


     下图是我这边转换的效果对比,左边是原视频,右边是转换后的视频:




     所有人都会觉得,转换后品质下降了很多,确实是这样,同时可以发现转换后的文件由原来的13M变成了1M,如果要提高品质,可以将vbitrate=500改为vbitrate=5000。


     转换后的效果对比,左边是原视频,右边是转换后的视频:



     品质几乎一样了,但同时,转换文件变成了6M。


     关于命令中的一些参数,解释一下:


-o ””E:\output.flv””:是输出文件路径;


-of lavf:是输出文件格式,这里不是flv而是lavf,是因为flv属于libavformat;


-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames:-lavfopts表示对lavf进行一 些设置,设置的内容就是i_certify_that_my_video_stream_does_not_use_b_frames,翻译成中文就是: 我确定,我的视频不用B frames,对于转换flv格式,最好加上这个参数,否则可能会报错,如图:



-oac mp3lame:oac=output audio codec,输出音频编码器,这里用的mp3lame;


-lameopts abr:br=56:lame options,是专门针对mp3lame的参数设置,abr:br=56,是设置音频比特率为56(比特率:每秒钟输出的音频大小,单位kb/s);


-ovc lavc:ovc=output video codec,输出视频编码器,lavc表示one of libavcodec’s video codec,输出格式为libavformat之一,编码器当然也是libavcodec之一啦,至于libavodec里都有哪些编码器,可以查看 Mplayer的官方文档;


-lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:v4mv:trell:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1:对lavc进行一些设置,详细介绍如下:
vcodec=flv:指定视频编码器为flv;
vbitrate=500:指定视频比特率为500,这个参数很重要,vbitrate大了可以让视频品质增加,但会让文件变的很大(可以参考flash8自带的转换工具的参数:低品质为150kb/s,中等品质为400kb/s,高品质为700kb/s)。
mbd:宏模块选择算法,值为0~2默认为0,值越大转换越缓慢,但在品质和文件大小方面有好处;
mv0:编译每个宏模块并选择最好的一个,当mbd=0时无效;
v4mv:会稍微增加品质,mbd>0时效果更明显;
trell:量子化网格搜索,对每8×8block找到最优化编码;
cbp:只能和trell一期使用,评估失真的图像块编码;
last_pred=3:与上一帧相比的移动数量预测,值为0~99,1~3比较合适,大于3时对品质的提高已经无关紧要,但却会降低速度;
dia=4:移动搜索范围,值为-99~6,对于快速转换,-1是个不错的值,如果不是很重视速度,可以考虑2~4;
cmp=6:值为1~2000,默认为0,设置用于全象素移动预算的比较函数
vb_strategy=1:对动作很大的场景会有帮助,对有些视频,设置vmax_b_frames会有损品质,加上vb_strategy=1会好点。


     以上是对-lavcopts的详细解释,接下来继续说明mencoder的参数:


-vf scale=512:-3:-vf表示视频格式,scale是缩放,512:-3表示强制将宽度设置为512,高度写为-3表示保持高宽比,也可以设置为 -1或-2,具体表示什么,有兴趣的可以尝试一下。如果要强制转化为统一大小,可以直接写-vf scale=640:480,但笔者个人建议用-3来保持高宽比。-vf里还有expand和crop参数,例如:-vf scale=512:384,expand=512:384:::1,crop=512:384:0:0,expand表示膨胀,crop表示裁剪;


-ofps 12:输出视频的帧频,一般,用于flash播放的视频帧频高了没有没有意义,反而会增加视频文件大小,但如果ofps设置的不合适,比如源视频帧频不是 ofps的整数倍,可能会导致转换后的视频、音频不同步,似乎可以将这一参数改为-noskip来解决这一问题;


-srate 22050:音频采样率一般为22050或44100。


     对于转换flv格式,lavsopts的设置比较重要,还有很多参数本文没有涉及到,在笔者参考的文献中会有具体的说明,感兴趣的可以去看一下。我对于 Mencoder的认识主要也是来源于下面2篇文章,实践的比较少,如果有理解和翻译的失误,再次欢迎与我交流。



参考文献:


《Mplayer官方文档,英文版》http://www.mplayerhq.hu/DOCS/HTML-single/en/MPlayer.html
《Linux Reviews》http://linuxreviews.org/man/mencoder/


关于用mencoder将各种格式转换为flv格式,网络上应该也有一些文章,我把最近学习的心得和大家分享一下.
如果您正准备开始使用mencoder,似乎也可以当作教程来看,如果您有更好的方法或技术,请不吝赐教!
mencoder,可以从其官方网站上获得:
http://www.mplayerhq.hu
下载完之后,修改一下环境变量,将mencoder.exe及mplayer.exe文件所在的目录添加到path变量里。
mencoder是在命令行中执行的(官网上的文档里的实例似乎都是linux下的)
我是计算机小白,当然只会使用windows……
开始菜单 -> 运行 -> cmd -> 回车,就打开了命令行窗口
这时,我们可以拿一个视频来试试看,我用的是一个mtv,wmv格式的,文件名:APerfectMatch.wmv。
在命令行中输入:(注意,不要从网页上直接copy这段命令到cmd,windows的命令行似乎是不支持换行的……)
mencoder “D:\music\sk8ter_boi_300.wmv” -o “D:\output.flv” -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050
按下回车后,如果你看到显示:“mencoder 不是内部或外部命令,也不是可运行的程序,或批处理文件”,那么说明环境变量没有设置好
如果正常,会看到开始转视频,会看到一排一排的字往上翻,内容大概是这样:
Pos: 226.8s 297f (100%) 48fps Trem: 0min 5mb a-v:-0.009 [142:56]
这里边的内容,我最关注的是2个括号里面的,小括号里应该是转换的进度,中括号里的内容很重要,142表示视频比特率,56表示音频比特率(比特率这个词不知道用的对不对……)
转换结束,会显示2行文字:
Video stream: 142.564 kbit/s (17820 B/s) size: 4046677 bytes 227.080 secs 2700 frames
Audio stream: 56.938 kbit/s (7117 B/s) size: 1616197 bytes 227.082 secs
这2 行信息我想大家都能明白,其中我一直关注的是那个142.564kbit/s,用过flash8自带转换工具的应该知道高级设置里有个选项是最大数据速 率,当选中中等画质的时候,是400kb/s,而低品质也是150kb/s,也就是说,用那句命令转换的视频,其画质都不如品质的,那么,品质怎么样呢? 看一下,怎么看flv文件?别忘了我们有万能播放器mplayer,哈哈,直接在命令行里输入:
mplayer “d:\output.flv”,看到咱们刚刚转好的视频,我当时一看,画面上马赛克倒是没有,全是瓷砖,我晕倒…
进入正题了,怎么来提高画面品质?(晕倒,原来前面都不是正题…=_=o)
回头看一下我们的命令行:
mencoder “D:\music\sk8ter_boi_300.wmv” -o “D:\output.flv” -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050。
下面一个一个分析:
mencoder 说明你用的是mencoder;
“d:\…..wmv” -> 是指你的输入视频;
-o -> 后面指定输出路径;(前面有“-”的都是option(选项的意思))
-of -> 大概是output format的缩写,输出文件格式,咦!为什么不是flv,而是lavf?lavf表示你使用了libavcodec里的格式,flv正好是libavcodec里的,呵呵;
-oac -> 大概是output audio codec的缩写,指定输出音频编码,这儿选用的是mp3lame;
-lameopts -> 指定lame的options,就是设置音频输出的一些参数啦,我只关心视频,跳过
-ovc -> 大概是output video codec的缩写,制定输出视频编码(我最关心的好像要上场了),选用的lavc,什么意思?说是用了libavcodec的编码器;
-lavcopts -> 是lavc的options,要设置视频编码的参数了!(心跳加速,血压升高,口中开始大量分泌唾液),看看它后面都有什么:
codec=flv 说的是用的flv编码器,这个咱不理;
vbitrate=150 video bit rate!视频数据速率!就是它了!原来我设的是150啊!
找到了,下面不看了!改成vbitrate=1000,再试试看!
结果,和前一次一模一样……(我还改成10000的,真的,还是一样,我当时以为它的单位是b/s而不是kb/s)
冷静下来,去往上看了一下官方文档,这个参数是最大数据速率,最大嘛,你设多大都一样啊,看来不是靠它来控制品质。
不卖关子了,直接给出我的结论吧,设置品质有2种途径:
1、设置-lavcopts,看这样一句命令:
mencoder “D:\music\APerfectMatch.wmv” -o “D:\output.flv” -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=320:240,expand=320:240:::1,crop=320:240:0:0 -ofps 30 -srate 22050
看看多了什么?
在-lavcopts里多了dia=4:cmp=6:vb_strategy=1这3条
他们的含义我只是大概了解一点点,毕竟不是专业搞视频编码的
dia越大品质越高,如果需要快速编码,设置为-1,设为4时已经很有利于品质了;
cmp越大品质越高,默认值0,是最快速的,一般设到3,设为6已经只会细微提高品质了,但速度会慢
vb_strategy,大概是1或者0,默认值可能为0,我这里设为1,会对编码有帮助,这个参数我自己没有过多推敲,可能并不影响品质……
2、加-sws选项,看下面的命令:
mencoder “D:\music\APerfectMatch.wmv” -o “D:\output.flv” -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -sws 3 -vf scale=320:240,expand=320:240:::1,crop=320:240:0:0 -ofps 30 -srate 22050
只是加一个 -sws 3进去,转换后的效果和前面一种方法大致相同,视频数据速率都是422.5kb/s左右,解释一下
-sws就是用来设置品质的,默认值为2,那么,为什么不用这种简单的方式呢?我个人认为,用前面一种方法有利于找到一个速度和品质的平衡点,毕竟变化的范围比较大。
其他一些选项,我也没有深入研究。


需要用到的组件
ASPExec
mencoder
ffmpeg.exe

第一步骤: 在线转换

Set Executor = Server.CreateObject(“ASPExec.Execute”)
Executor.Application = “cmd /c mencoder E:\qiancheng\upload\”&request.QueryString(“keys”)&” -o E:\qiancheng\shipin\record\streams\_definst_\record\”&lid&”\”&keys&”.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -lavcopts vcodec=flv:vbitrate=200:mbd=2:mv0:v4mv:last_pred=3:dia=3:cmp=3:vb_strategy=1 -vf scale=330:-3 -ofps 12 -srate 22050″
Executor.Parameters = “”
strResult = Executor.ExecuteDosApp

asp执行 .bat文件

第二步骤: 通过ffmpeg生成所略图+fso 删除源件

Server.ScriptTimeout=0
flvname=keys
streamPath=”../shipin/record/streams/_definst_/record/”&lid&”/”&flvname&”.flv”
imgW =”120″
imgY = “90”
imgQuality = “100”
ss=”3″
newName = “../upload/”&flvname&”.jpg”
str=”e:\qiancheng\webadmin\ffmpeg.exe”
str=str+” -i “&server.mappath(streamPath)&” -ss 3 -vframes 1 -r 1 -ac 1 -ab 2 -s 120*90 -f image2 “&server.mappath(newName)&””
Set shellffmpeg=server.CreateObject(“ffmpeg.shellffmpeg”)
aa=shellffmpeg.shellffmpeg1(str)
Set shellffmpeg = Nothing
””删除上传的文件
tupianid=”../upload/”&request.QueryString(“keys”)
set   fso=server.CreateObject(“scripting.filesystemobject”)   
if fso.FileExists(Server.MapPath(tupianid))   then   
fso.deletefile(server.MapPath(tupianid))   
end if   
set fso=nothing

flash视频整站程序制作完成, 在线录制视频+音频+ 缩略图+在线转flv +asp + sqlserver

ffmpeg和Mencoder使用实例小全(转贴)


ffmpeg和Mencoder使用实例小全(转贴)

下载电影的时候,我们总希望在全部下载完成之前能够预览一下影片内容,于是发布者时常会放一些影片截图在种子文件中,或者直接贴到网上,也有一些截图是一张图片,但包含很多幅影片在一起,就像下面这张:
imagemagick-montage-sample

有很多软件能够截取影片图像、合并图像,但如果影片太多,比如视频网站为用户上传的图像生成预览图之类的,人工在gui方式下操作就不可取了,我们需要在命令行方式下来截取、合并。

首先,截取影片图像使用最多的就是mplayer或者ffmpeg,我用mplayer比较熟,本文就以此为例了,ffmpeg功能也是非常强大的,但据说支持的文件格式却不丰富。mplayer截取影片图像的基本命令为:

mplayer -ss START_TIME -noframedrop -nosound -vo jpeg -frames N NAME_OF_VIDEO_FILE   
上例中,-ss指定开始的时间,结合-frames参数,限定从某个时间开始、截取几帧图像。为了体现整个影片的内容,我需要在影片中间隔时间相同的几个 点、每个点截取1帧图像,所以按道理应该用-frames 1,但是mplayer这样截图的情况下,第一帧似乎永远都会截取到一个黑屏,所以我常用-frames 2。截取下来的图像保存在了当前目录,名称从00000001.jpg开始依次递增,按照-frames 2,就是取00000002.jpg为结果,删除00000001.jpg即可。经过简单实验,在截取wmv、rmvb影片时,前面的好几帧都会是黑屏, 也只能参考上面的做法多取几帧了。

为了取影片中间隔大致相同的几个点,可以用-ss指定时间,也可以用-sb指定开始字节,在我的实际使用中,使用-sb只会得到黑屏,所以通过文件大小来 设置间隔点的办法不行,只能用-ss时间间隔了,这就需要首先得到影片的总时间。好在mplayer为我们提供了类似的功能:

mplayer -identify movie-filename -nosound -vc dummy -vo null   
这样会输出一大堆影片信息,从中截取所需内容即可,在bash shell中,取得影片总时间长度(以秒为单位)的命令如下:

FILESIZE=`mplayer -identify -nosound -vc dummy -vo null $1 | grep ID_LENGTH | sed -r ‘s/ID_LENGTH=([[:digit:]]*)(.[[:digit:]]*)?/1/g’`   
有了影片的总时长,我们就可以根据所要截取的帧数,计算出每个间隔点的时间位移了。不过要注意一般影片的开始-ss 0和结束-ss TOTAL_TIME_OF_VIDEO截取下来都会是黑屏,在处理的时候要分别加上和减去若干秒。

截取工作完成后,我们拥有了一堆000000xx.jpg文件,如果能把这些文件都放到一个文件中,每行2张,成为一张大图片,在发布的时候会很方便。所 以,我们使用imagemagick([url]http://www.imagemagick.org/script/index.php [/url])中的montage命令来实现:

montage -geometry +0+0 -tile 2 *.jpg montage.jpg   
-geometry +0+0是设定使用原始图片大小,-tile 2参数设定每行放2张图片,最后一个参数是要生成的目标文件名,现在,我们就能够得到像刚才那张一样的图片了。

原理已经讲清楚了,可以自己写一个bash脚本来方便调用,我在网上找到了一个很不错的例子([url]http: //www.linuxquestions.org/questions/showthread.php?t=361072[/url]),可以在这个基 础上进行修改,过程不再详述了。

下面再列一些在网上找到的其他mplayer、mencoder、ffmpeg的使用实例:

mplayer获取影片信息
mplayer -identify movie-filename -nosound -vc dummy -vo null
从所有输出中可以grep到如下信息:
– filetype: ASF file format detected.
– dimensions and format: VIDEO: [MP43] 320×240 24bpp 1000.000 fps 0.0 kbps ( 0.0 kbyte/s)
– video format: ID_VIDEO_FORMAT=MP43
– width (dimensions): ID_VIDEO_WIDTH=320
– height (dimensions): ID_VIDEO_HEIGHT=240
– length in seconds: ID_LENGTH=98.00
参考8([url]http://gallery.menalto.com/node/40548[/url])

mencoder图片做成电影
#用当前目录中的所有JPEG文件创建DivX4文件:
mencoder *.jpg -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi
#用当前目录中的一些JPEG文件创建DivX4文件:
mencoder -mf on:w=800:h=600:fps=25 -ovc divx4 -o output.avi *.jpg
#用当前目录中的所有JPEG文件创建Motion JPEG(MJPEG)文件:
mencoder -mf on:w=800:h=600:fps=25 -ovc copy -o output.avi *.jpg
#用当前目录中的所有PNG文件创建一个非压缩的文件:
mencoder -mf on:w=800:h=600:fps=25:type=png -ovc rawrgb -o output.avi *.png
简单用法:
mencoder *.jpg -mf on:fps=15 -o output.avi -ovc xvid
参考6 参考7([url]http://huangjiahua.livejournal.com/99358.html[/url])

ffmpeg屏幕录像
ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -vd x11:0,0 -s 1024×768 ~/test.avi
其中,-vd x11:0,0 指录制所使用的偏移为 x=0 和 y=0,-s 1024×768 指录制视频的大小为 1024×768。录制的视频文件为 test.avi,将保存到用户主目录中。其他选项可查阅其说明文档。
如果你只想录制一个应用程序窗口或者桌面上的一个固定区域,那么可以指定偏移位置和区域大小。使用xwininfo -frame命令可以完成查找上述参数。
你也可以重新调整视频尺寸大小,如:./ffmpeg -vcodec mpeg4 -b 1000 -r 10 -g 300 -i ~/test.avi -s 800×600 ~/test-800-600.avi。
参考5([url]http://linuxtoy.org/archives/ffmpeg.html[/url])

mplayer对video进行截屏 截图(wmv mpeg mov flv all works)
mplayer 78.mov -ss 1 -nosound -vo jpeg:outdir=./ -frames 2
我截的第一张图不知为何全部都是黑屏
参考4([url]http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=165254[/url])

转换为flv文件
mencoder NOW.wmv -ffourcc FLV1 -of lavf -ovc lavc -lavcopts vcodec=flv:acodec=mp3:abitrate=56 -srate 22050 -oac mp3lame -o NOW.flv
ffmpeg -i a.asf -ab 56 -ar 22050 -b 500 -r 15 -s 320×240 asf.flv
参考3([url]http://www.roading.net/blog/article.asp?id=114[/url])

使用ffmpeg抓图
ffmpeg -i test2.asf -y -f image2 -ss 08.010 -t 0.001 -s 352×240 b.jpg
jpg: ffmpeg -i test.asf -y -f image2 -t 0.001 -s 352×240 -ss a.jpg //注意-ss就是要提取视频文件中指定时间的图像
jpg: ffmpeg -i asf.flv -y -f image2 -t 1 asf.jpg
gif: ffmpeg -i test.asf -vframes 30 -y -f gif a.gif
参考3 参考2([url]http://www.killflash.net/blog/article.asp?id=77[/url])

如何合并几个视频片段
mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi
* 其中,-oac copy 选项告诉 mencoder 要正确拷贝音频流。而 -ovc copy 选项则是拷贝视频流。
* 如果在视频文件中没有找到索引的话,那么 -idx 选项会要求 mencoder 建立它。
* -o 选项指定输出文件的名称。
* 最后几个参数为需要合并的几个视频片段。
参考1 ([url]http://linuxtoy.org/archives/join_several_videos.html[/url])

大杂烩
服务器端转换工具(Server-Side-FLV-Conversion)
场景:想把 MPG 或 AVI 上传到你的服务器并自动转换成 FLV 吗?
1,FFmpeg ([url]http://sourceforge.net/projects/ffmpeg[/url]) | 教程一 ([url]http://soenkerohde.com/tutorials/ffmpeg[/url]) | 教程二 ([url]http://klaus.geekserver.net/flash/streaming.html[/url])(Google Video 使用的就是这个东东.)
2,Flix Engine ([url]http://www.on2.com/developer/flix-engine-sdk[/url]) | 教程 ([url]http://www.flexauthority.com/articlesIndex.cfm[/url]) | 范例 ([url]http://www.flexauthority.com/Samples/FlixEngine/index.html[/url])
3,Turbine Video Engine ([url]http://www.blue-pacific.com/products/turbinevideosdk/default.htm[/url])
4,Video to Flash Console ([url]http://www.geovid.com/Video_to_Flash_Console[/url])

录像/实时广播(Record/Broadcast)
场景:想制作一个语音视频Blog满足自恋的欲望吗?
1,RED5 ([url]http://www.osflash.org/red5[/url])
2,Flash Media Server ([url]http://www.macromedia.com/go/fms[/url])
在线编码,分享视频(Online Encode & Share)
场景:想不花钱就可以在线分享你的视频吗?
1,Google Video ([url]http://video.google.com/[/url])
2,You Tube ([url]http://www.youtube.com/[/url])
本地 FLV 文件播放器(FLV Player)
场景:拿到了 FLV 文件不知道怎么播放了.
1,martijndevisser FLV Player ([url]http://www.martijndevisser.com/2005/10/flv_player_updated.html[/url])
2,FlashGuru FLV Player ([url]http://www.flashguru.co.uk/free-tool-flash-video-player[/url])
3,FCZone FLV Player ([url]http://fczone.com/2006/01/fms-media-player.cfm[/url])
在线 FLV 文件播放器(Online FLV Player)
场景:知道一个在线FLV地址,又懒得下载和安装播放器.
1,Loadr ([url]http://dengjie.com/loadr[/url])
2,Google Player Generator ([url]http://dengjie.com/loadr/r.swf?file=/temp/google_player.swf&clr=000FFF[/url])
更多相关软件看这篇文章:Flash 网站的视频策略 ([url]http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_14571[/url])

此文章转自 shadow

ffmpeg 参数

利用ffmpeg+mencoder视频转换的总结
[url]http://www.yitian130.com/article.asp?id=69[/url]

flv视频转换和flash播放的解决方案笔记
[url]http://blog.verycd.com/dash/showentry=35982[/url]

Youtube技术原理
1. 网页文件允许上传视频文件(这个和上传其他文件一样的)(作者用的是python的架构)
2. 后台调用ffmpeg对上传的视频进行压缩,输出flv格式的文件。这个开源程序win32和linux都有实现,所以可以适应不用的主机环境。
3. 使用flvtools处理flv文件,标记上时长、帧速、关键帧等元数据,这样的flash文件才可以拖放。
4. 使用 ffmpeg 产生flv文件的缩略,和大图像文件的缩略图是一个道理。
5. 使用适当的flv播放器在网页中播放服务器端生成的flv文件。
更多详细:[url]http://www.gotonx.com/bbs/simple/index.php?t6322.html[/url]

安装和使用ffmpeg转换视频为flv文件(windows和linux)

1、环境winxp-sp2下:
从 [url]http://ffdshow.faireal.net/mirror/ffmpeg/[/url] 下载
最新版本的 FFMpeg.exe直接用就行(须rar解压)。

以下的东西是为对ffmpeg无法解析的文件格式(wmv9,rm,rmvb等)转换用的,
从[url]http://mediacoder.sourceforge.net/download_zh.htm[/url]下载
最新版本的mediacoder的安装后;找到其中的mencoder.exe;drv43260.dll和pncrt.dll三个文件。

2、环境linuxas4。3下:

a、先装mp3在linux下的包:lame-3.97.tar.gz;
tar -xvzf lame-3.97.tar.gz;
cd lame-3.97;
//(默认是装在/usr/local下);
//–prefix=/usr/此参数一定要(便于调用os的其它系统包)
//–enable-shared此参数一定要
./configure –enable-shared –prefix=/usr/;
make;
make install;

b、支持3gp格式,这也是现在好多手机支持的格式,因为手机用户是我们的主要用户,所以也得支持编译

编译的时候加上–enable-amr_nb –enable-amr_wb参数就行,根据编译系统的提示,所以我们得下载一些编译3gp所需得文件。

wget [url]http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip[/url]
解压以后把里面的文件都拷贝到libavcodec/amrwb_float/

wget [url]http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-510.zip[/url]
解压以后把里面的文件都拷贝到libavcodec/amr_float/

c、mpg4 aac格式支持,由于服务器还针对手机用户服务,所以,类似aac,mpg4铃声格式的支持,我们也得做。这里我们安装faad2和faac就行
下载请到[url]http://www.audiocoding.com/modules/mydownloads/[/url]

tar zxvf faad2-2.5.tar.gz
cd faad2
echo > plugins/Makefile.am
echo > plugins/xmms/src/Makefile.am
sed -i ‘/E_B/d’ configure.in
autoreconf -vif
./configure –prefix=/usr
make &&
make install

tar zxvf faac-1.25.tar.gz
cd faac
sed -i ‘/[2de].M/d’ configure.in
echo “AC_OUTPUT(common/Makefile common/mp4v2/Makefile libfaac/Makefile frontend/Makefile include/Makefile Makefile)” >> configure.in
autoreconf -vif
./configure –prefix=/usr
make &&
make install

d、支持xvid; x264,现在最流行的两种高质量的压缩格式
xvid的编译安装
wget [url]http://downloads.xvid.org/downloads/xvidcore-1.1.2.tar.gz[/url]
tar zvxf xvidcore-1.1.2.tar.gz

cd xvidcore-1.1.2/build/generic
./configure –prefix=/usr –enable-shared
make
make install

x264的获取同样是采用svn方式:
svn co svn://svn.videolan.org/x264/trunk x264

linux下须从[url]http://www.kernel.org/pub/software/devel/nasm/binaries/linux/[/url]下载nasm-0.98.39-1.i386.rpm

在linux下安装就行了。。。

rpm -ivh nasm-0.98.39-1.i386.rpm(如-ivh不行就用-Uvh)

cd x264
./configure –prefix=/usr –enable-shared
make
make install

e、安装ffmpeg:
//as4.3系统已经支持ac3编码,只要加–enable-a52 –enable-gpl参数就行
//我加–enable-shared参数没有成功
./configure –prefix=/opt/ffmpeg/ –enable-mp3lame –enable-amr_nb –enable-amr_wb –enable-a52 –enable-xvid –enable-x264 –enable-faad –enable-faac –enable-gpl –enable-pthreads;
make clean;//一定要;否则有可能没声音。
make;
make install;

在相应windows和linux目录下(有ffmpeg文件的;以下用linux下说明):
3、使用ffmpeg转换视频为flv文件:
./ffmpeg -i “/opt/input/1.mpg” -y -ab 32 -ar 22050 -b 800000 -s 640*480 /opt/output/1.flv”
ffmpeg能解析的格式:(asx,asf,mpg,wmv,3gp,mp4,mov,avi,flv等)

对ffmpeg无法解析的文件格式(wmv9,rm,rmvb等),
可以先用别的工具(mencoder)转换为avi(ffmpeg能解析的)格式.
./mencoder /input/a.rmvb -oac lavc -lavcopts acodec=mp3:abitrate=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o /output/a.avi
在执行./ffmpeg -i “/opt/input/a.avi” -y -ab 32 -ar 22050 -b 800000 -s 640*480 /opt/output/a.flv”就可以转了。

4、视频抓图:
./ffmpeg -i “/opt/input/a.flv” -y -f image2 -t 1 -s 300*200 “/opt/output/1.jpg” //获取静态图

./ffmpeg -i “/opt/input/a.mpg” -vframes 30 -y -f gif “/output/1.gif” //获取动态图;
不提倡抓gif文件;因为抓出的gif文件大而播放不流畅。

用mencoder在线转换视频格式并控制视频品质
[url]http://blog.sina.com.cn/u/490343a7010006z6[/url] 

日誌分析工具 access.log analysis


Visitors is a very fast web log analyzer for Linux, Windows, and other Unix-like operating systems. It takes as input a web server log file, and outputs statistics in form of different reports. The design principles are very different compared to other software of the same type:


  • No installation required, can process up to 150,000 lines of log entries per second in fast computers (20MB/s with my log files average length).
  • Designed to be executed by the command line, output html and text reports. The text report can be used in pipe to less to check web stats from ssh.
  • Support for real time statistics with the Visitors Stream Mode introduced with version 0.3.
  • To specify the log format is not needed at all. Works out of box with apache and most other web servers with a standard log format (see the documentation for more information on the format).
  • It’s a portable C program, can be compiled on many different systems. Binaries for Windows systems are in the Download section of this page.
  • The produced html report doesn’t contain images or external CSS, is self-contained, you can send it by email to users.
  • Visitors is free software (and of course, freeware), under the terms of the GPL license. You don’t need to pay to use it. Visitors is supported, if you want a custom version made directly by the original author for a modest price, contact me at antirez (at) invece (dot) org. ISPs may take advantage of the high processing speed.

  •  


    download:http://www.hping.org/visitors/visitors-0.7.tar.gz

    Resin-pro-3.1.6 full crack download



    Caucho Technology is an engineering company devoted to reliable open source and high performance Java-PHP solutions. Caucho is a Sun Microsystems Java EE licensee whose products include Resin application server, Hessian web services and Quercus Java-PHP solutions.


    Resin Professional is the application server of choice for over 7,500 companies. Technical support is handled by Caucho engineers and not outsourced, meaning that when you contact Caucho for a support issue, you receive a fast response directly from the engineers who write the code. Resin runs on all major operating systems including Linux, Windows and Solaris.


     

    Resin-pro-3.1.6 full crack download

    Windows


    Linux

    SecureCRT v6.0.1 crack key keygen


    SecureCRT gives you an encrypted Secure Shell (SSH1 and SSH2) session with servers and devices. For SSH, Telnet, Telnet/SSL, and other protocols, SecureCRT`s tabbed sessions reduce desktop clutter and make it easy to switch between sessions and organize groups of connected sessions. Extensive session management and customization features include named sessions, and multiple-session windows. Choose from a wide range of emulations including VT100, VT102, VT220, ANSI, SCO ANSI, Wyse 50/60, Xterm, and Linux console. SecureCRT can help you save valuable time by automating routine configuration tasks with powerful scripting capabilities.


    download : 
                   SecureCRT 6.0.1
                   Crack

    shell 比较两个字符串

    比较两个字符串是否相等的办法是:

    if [ “$test”x = “test”x ]; then

     

    这里的关键有几点:

    1 使用单个等号

    2 注意到等号两边各有一个空格:这是unix shell的要求

    3 注意到”$test”x最后的x,这是特意安排的,因为当$test为空的时候,上面的表达式就变成了x = testx,显然是不相等的。而如果没有这个x,表达式就会报错:[: =: unary operator expected

    resin-pro-3.1.5 full cracked.

     虽然resin-pro-3.1.5早在2月26号就发布了,但一直标记为dev,今天发现已经不是dev了,赶紧下载回来破解。


    resin-pro-3.1.5.zip 下载


    resin-pro-3.1.5.tar.gz 下载


    此次破解的跟上次的3.1.3一样,功能上完全没有任何限制了,可以使用session持久化、cache等,只需要做好相关的配置即可。


     3.1.5的Change Log请看官方文档:Resin Change Log,同时可以看到3.1.6 snapshot了。 我会及时破解Resin的最新版本!


    文章来源:http://www.dingl.com/blog/archives/28


    resin 3.1使用总结.

      使用resin已经有四、五年了,但以前都是做一些小系统,resin的压力并不大,近段时间做一个大系统,日平均ip上10万,resin的压力非常的大,除了对程序做优化以外,resin 的优化也小不了。

     

     

    一、优化配置

      修改 conf/resin.conf 文章中的 JVM参数

     

    <jvm-arg>-Xms512m</jvm-arg>
    <jvm-arg>-Xss128k</jvm-arg>
    <jvm-arg>-Xmn184m</jvm-arg>
    <jvm-arg>-XX:ParallelGCThreads=20</jvm-arg>
    <jvm-arg>-XX:+UseConcMarkSweepGC</jvm-arg>
    <jvm-arg>-XX:+UseParNewGC</jvm-arg>
    <jvm-arg>-Xdebug</jvm-arg>
    <jvm-arg>-Xloggc:gc.log</jvm-arg>

     

      修改 最大thread-max为2500

          <!– Maximum number of threads. –>
          <thread-max>2500</thread-max>

          <!– Configures the socket timeout –>
          <socket-timeout>65s</socket-timeout>
            
          <!– Configures the keepalive –>
          <keepalive-max>10240</keepalive-max>
          <keepalive-timeout>30s</keepalive-timeout>

     

    二、利用resin-admin监控resin运行情况。


     

    第一行是Thread pool情况,如果发现Peak大于thread max,就应该修改conf/resin.conf 中的thread-max,相应的增大thread-max。

    第二行是Threads,如果长期出现在这里而又不是SUN的方法,或者resin的方法的话,就要对这些方法进行测试、优化。