也可以在这里下载这两个包 :amrwb_float下载,amr_float下载.
amr-wb:http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.1.tar.bz2
amr-nb:http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.4.tar.bz2
#tar xjvf amrnb-6.1.0.3.tar.bz2
#cd amrnb-6.1.0.3
#./configure --prefix=/usr --enable-shared
#make
#make install
#tar xjvf amrwb-7.0.0.0.tar.bz2
#cd amrwb-7.0.0.0
#./configure --prefix=/usr --enable-shared
#make
#make install
错误libavformat.so.51: cannot open shared object file的解决方法,
如果没有装在、usr(--prefix=/usr),此错误一般都会出现
> >>Error: h1124192:~/src/ffmpeg_20061208# ffmpeg
> >>ffmpeg: error while loading shared libraries:
> >>libavformat.so.51: cannot
> >>open shared object file: No such file or directory
> >>
#ldconfig -v
查看libs文件的位置,发现没有包括/opt/ffmpeg/lib
#vi /etc/ld.so.conf
加入/opt/ffmpeg/lib就是你安装ffmpeg lib的位置
make
make install
1)ffmpeg篇:
ffmpeg的命令行参数因为太多,这里不列出,可以用ffpmeg -h可以查看到.列出非高级参数如下:
-L show license
-h show help
-version show version
-formats show available formats, codecs, protocols, ...
-f fmt force format
-i filename input file name
-y overwrite output files
-t duration set the recording time
-fs limit_size set the limit file size
-ss time_off set the start time offset
-itsoffset time_off set the input ts offset
-title string set the title
-timestamp time set the timestamp
-author string set the author
-copyright string set the copyright
-comment string set the comment
-album string set the album
-v verbose control amount of logging
-target type specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ...)
-dframes number set the number of data frames to record
-scodec codec force subtitle codec ('copy' to copy stream)
-newsubtitle add a new subtitle stream to the current output stream
-slang code set the ISO 639 language code (3 letters) of the current subtitle stream
Video options:
-vframes number set the number of video frames to record
-r rate set frame rate (Hz value, fraction or abbreviation)
-s size set frame size (WxH or abbreviation)
-aspect aspect set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-croptop size set top crop band size (in pixels)
-cropbottom size set bottom crop band size (in pixels)
-cropleft size set left crop band size (in pixels)
-cropright size set right crop band size (in pixels)
-padtop size set top pad band size (in pixels)
-padbottom size set bottom pad band size (in pixels)
-padleft size set left pad band size (in pixels)
-padright size set right pad band size (in pixels)
-padcolor color set color of pad bands (Hex 000000 thru FFFFFF)
-vn disable video
-vcodec codec force video codec ('copy' to copy stream)
-sameq use same video quality as source (implies VBR)
-pass n select the pass number (1 or 2)
-passlogfile file select two pass log file name
-newvideo add a new video stream to the current output stream
Subtitle options:
-scodec codec force subtitle codec ('copy' to copy stream)
-newsubtitle add a new subtitle stream to the current output stream
-slang code set the ISO 639 language code (3 letters) of the current subtitle stream
Audio/Video grab options:
-vd device set video grab device
-vc channel set video grab channel (DV1394 only)
-tvstd standard set television standard (NTSC, PAL (SECAM))
-ad device set audio device
-grab format request grabbing using
-gd device set grab device
Advanced options:
-map file :stream[:syncfile :syncstream] set input stream mapping
-map_meta_data outfile :infile set meta data information of outfile from infile
-benchmark add timings for benchmarking
-dump dump each input packet
-hex when dumping packets, also dump the payload
-re read input at native frame rate
-loop_input loop (current only works with images)
-loop_output number of times to loop output in formats that support looping (0 loops forever)
-threads count thread count
-vsync video sync method
-async audio sync method
-vglobal video global header storage type
-copyts copy timestamps
-shortest finish encoding within shortest input
-dts_delta_threshold timestamp discontinuity delta threshold
-ps size set packet size in bits
-muxdelay seconds set the maximum demux-decode delay
-muxpreload seconds set the initial demux-decode delay
如果这些都明白了 ,并且有编程基础,你就可以去参与ffmpeg开发了.其实这些堆积起来的命令95%一般是用不上的.这里介绍一些简单的常见的命令:
-fromats 显示可用的格式
-f fmt 强迫采用格式fmt
-I filename 输入文件
-y 覆盖输出文件
-t duration 设置纪录时间 hh:mm:ss[.xxx]格式的记录时间也支持(截图需要)
-ss position 搜索到指定的时间 [-]hh:mm:ss[.xxx]的格式也支持
-title string 设置标题
-author string 设置作者
-copyright string 设置版权
-comment string 设置评论
-target type 设置目标文件类型(vcd,svcd,dvd),所有的格式选项(比特率,编解码以及缓冲区大小)自动设置,只需要输入如下的就可以了:ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
-hq 激活高质量设置
-b bitrate 设置比特率,缺省200kb/s
-r fps 设置帧频,缺省25
-s size 设置帧大小,格式为WXH,缺省160X128.下面的简写也可以直接使用:Sqcif 128X96 qcif 176X144 cif 252X288 4cif 704X576
-aspect aspect 设置横纵比 4:3 16:9 或 1.3333 1.7777
-croptop/botton/left/right size 设置顶部切除带大小,像素单位
-padtop/botton/left/right size 设置顶部补齐的大小,像素单位
-padcolor color 设置补齐条颜色(hex,6个16进制的数,红:绿:蓝排列,比如 000000代表黑色)
-vn 不做视频记录
-bt tolerance 设置视频码率容忍度kbit/s
-maxrate bitrate设置最大视频码率容忍度
-minrate bitreate 设置最小视频码率容忍度
-bufsize size 设置码率控制缓冲区大小
-vcodec codec 强制使用codec编解码方式. 如果用copy表示原始编解码数据必须被拷贝.(很重要)
-ab bitrate 设置音频码率
-ar freq 设置音频采样率
-ac channels 设置通道,缺省为1
-an 不使能音频纪录
-acodec codec 使用codec编解码
-vd device 设置视频捕获设备,比如/dev/video0
-vc channel 设置视频捕获通道 DV1394专用
-tvstd standard 设置电视标准 NTSC PAL(SECAM)
-dv1394 设置DV1394捕获
-av device 设置音频设备 比如/dev/dsp
-map file :stream 设置输入流映射
-debug 打印特定调试信息
-benchmark 为基准测试加入时间
-hex 倾倒每一个输入包
-bitexact 仅使用位精确算法 用于编解码测试
-ps size 设置包大小,以bits为单位
-re 以本地帧频读数据,主要用于模拟捕获设备
-loop 循环输入流。只工作于图像流,用于ffserver测试
1.转换成flv文件:ffmpeg -i infile.* -y (-ss second_offset -ar ar -ab ab -r vr -b vb -s vsize) outfile.flv
其中second_offset是从开始的多好秒钟.可以支持**:**:**格式,至于ar,ab是音频的参数,可以指定ar= 22050,24000,44100(PAL制式),48000(NTSC制式),后两种常见,ab=56(视音频协议的codec而定,如果要听高品质,则80以上).vr,vb,vsize是视频参数,可以指定vr=15,25(PAL),29(NTSC),vb=200,500,800,1500 (视视频协议的codec而定,可以通过查看专业的codec说明文档获取
还有很多高级参数,如-qmin,-qcale等,请查看详细文档.
还有-an和-vn参数,分别从多媒体文件中提取出纯粹视频和音频.
另,如果你是用shell批量处理,请使用-y参数覆盖生成flv.
2.截取图片:ffmpeg -i infile.* -y (-ss second_offset) -t 0.001 -s msize (-f image_fmt) outfile.jpg
其中second_offset同上,msize同vsize,图片大小.image_fmt=image2强制使用jpg,image_fmt=gif,强制使用gif格式.
还可以用-vframes fn指定截取某帧图片,fn=1,2,3,...
mencoder的作用主要在视频转码方面.在安装完mplayer后,mencoder也编译生成了.可以man mencoder获取mencoder的说明文档.
mencoder的参数更加复杂,不过也无非是音频处理视频处理两个方面,可以参看网络例子: http://www.masoncn.com/pos...这里不作详细的列举了.
mencoder进行操作的常用方法: mencoder infile.* -o outfile.* [-ovc 目标视频格式] [-oac 目标音频格式] [-of 目标文件格式]
1.转换成flv文件: mencoder infile.* -o outfile.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
2.转换成avi文件: mencoder infile.* -o outfile.avi -of avi -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600
3.转换成wmv文件(复杂写法,其中高级参数可以省去): mencoder infile.* -o outfile.wmv -of lavf -ofps 25 -oac mp3lame -lameopts cbr:preset=128 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=768:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=320:240 -srate 22050 -sws 9 -subcp cp936 -subpos 0 -subalign 0 -subfont-text-scale 3 -lavfopts i_certify_that_my_video_strea
其中-ovc,-oac和-of是必须的,-ovc是指定视频codec,指定了ovc之后通常带一个该codec的opt参数,-oac是指定音频 codec,也会在其后带一个codec的opt参数.可以指定细节以决定视频音频质量和转换速率.具体的细节可以参看专业的技术文档.
对于第一个问题采用ffmpeg+mencoder可以获取一个让人可以接受的解决办法.第三个问题可以在上传之后安装一个前端过滤程序,区分音频文件和视频文件,已经有相应的开源工具和代码做这些事情.对于第二个问题,首先是统一格式,然后计算音视频文件的hash,在存储部分采用分布式CAS技术存储,应用方面构架在CAS之上.而第四个问题,第五个问题有待深入研究.第六个问题可以考虑p2p的方式,不过这个不是太重要.
|
3GP转FLV
mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok/1.3gp -o ok/3gp.flv
MOV转FLV
mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok/qtime.mov -o ok/mov.flv
RMVB转FLV
mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok/1.rmvb -o ok/rmvb.flv
WMV转FLV
mencoder -vf scale=320:240 -ffourcc FLV1 -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok/m9.wmv -o ok/m9.flv
以上的参数通用,只要在输入的ok/m9.wmv换成你自己相应的格式就好
裁图方面:
ffmpeg -i ok/3gp.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 3gp.jpg
ffmpeg -i ok/mov.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 mov.jpg
ffmpeg -i ok/mpeg.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 mpeg.jpg
ffmpeg -i ok/mp1.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 mp1.jpg
ffmpeg -i ok/mp2.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 mp2.jpg
ffmpeg -i ok/rm.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 rm.jpg
ffmpeg -i ok/rmvb.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 rmvb.jpg
ffmpeg -i ok/rv.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 rv.jpg
ffmpeg -i ok/mp4.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 mp4.jpg
ffmpeg -i ok/avi.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 avi.jpg
ffmpeg -i ok/m7.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 m7.jpg
ffmpeg -i ok/m8.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 m8.jpg
ffmpeg -i ok/m9.flv -y -f image2 -ss 8 -t 0.001 -s 320x240 m9.jpg
以上转完FLV,有个缺陷,就是FLV播放时不能拖放,要用下面的一个软件来修复。
在服务器上自动转,用命令行的。用这个,
要有用户界面的,手动修复的,用这个。
使用方法:
命令提示符下输入>flvmdi inputFile [outputFile][/s] [/x] [/e] [/k]
给个例子,后面的参数不加也可以修复,比如。
flvmdi.exe m7.flv
这样就行了。
修复OK。
FFMPEG下载
Mencoder最新版下载
|
7179



被折叠的 条评论
为什么被折叠?



