Mencoder 转 flv
mencoder -ffourcc FLV1 -lavfoptsi_certify_that_my_video_stream_does_not_use_b_frames -of lavf -oacmp3lame -lameopts aq=9:cbr:br=64:vol=2 -ovc lavc -lavcoptsvcodec=flv:vbitrate=200:acodec=mp3:abitrate=56 -vfscale=320:270,expand=320:270:::1,crop=320:270:0:0 -ofps
18 -srate 22050input.xxx -o output.flv
22050input.xxx —等待转换的原文件名
output.flv —转成.flv后的文件名
320:270 —视频的宽高
Mencoder 转 avi
mencoder input.xxx -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o output.avi
input.xxx —等待转换的原文件名
output.avi —转成.avi后的文件名
FFmpeg 转 flv
ffmpeg -i inputfile.xxx -ab 56 -ar 22050 -qmin 2 -qmax 16 -b 320k -r 15 -s 320x240 outputfile.flv
FFmpeg截图参数
对视频文件截图:
ffmpeg -i xxx.xxx -y -f image2 -ss 8 -t 0.001 -s 350x240 xxx.jpg
对已有flv截图:
ffmpeg -i xxx.flv -y -f image2 -ss 8 -t 0.001 -s 350x240 xxx.jpg
把视频的前30帧转换成一个Gif :
ffmpeg -i xxx.xxx -vframes 30 -y -f gif xxx.gif
截取从10秒开始持续10秒的片段
FFmpeg 加水印 参数:
ffmpeg -i inputfile.xxx -tagpict ":220:210" -ab 56 -ar 22050 -qmin 2 -qmax 16 -b 320k -r 15 -s 320x240 outputfile.flv
.NET应用和Java的应用
mencoder和ffmpeg在程序里的应用其实都比较简单,就是使用各语言中调用执行.exe文件的类去操作。
.net
string ffmpeg="C:\Inetpub\wwwroot\VideoDemo\ffmpeg\ffmpeg -i inputfile.xxx -ab 56 -ar 22050 -qmin 2 -qmax 16 -b 320k -r 15 -s 320x240 outputfile.flv";
System.Diagnostics.ProcessStartInfo FilestartInfo = new System.Diagnostics.ProcessStartInfo(ffmpeg);
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = FilestartInfo;
process.Start();
java
Process pro = Runtime.getRuntime().exec("C:\\Inetpub\\wwwroot\\VideoDemo\\ffmpeg\\ffmpeg.exe -i inputfile.xxx -ab 56 -ar 22050 -qmin 2 -qmax 16 -b 320k -r 15 -s 320x240 outputfile.flv");