后来用了下mencoder,转换是慢了点,但是质量不错,至少试了十来个wmv/asf还没看到花屏,并意外发现转换后的flv文件比ffmpeg转出来的小。
值得一提的是,mencoder比ffmpeg慢,占用系统资源也相对大一点。也许是我用的参数质量比较高,大家有空可以调整参数试试。
改了下SS/XS的convert.bat实现可以按照原来的计划任务自动进行转换
convert.bat内容如下
代码:
@echo off
for /R %1\video\temp %%I in (*.mov *.avi *.mpg *.mpeg) do call :Convert %1 %%~I %%~nI
for /R %1\video\temp %%I in (*.rm *rmvb *.wmv *.asf) do call :Convert1 %1 %%~I %%~nI
goto :END
:Convert SitePath FullFile FileName
setlocal enableextensions
set file=%3
set Path=%file:~-14,6%
IF NOT EXIST %1\video\%Path% mkdir %1\video\%Path%
C:\ffmpeg.exe -i %2 -y -ab 56 -ar 11025 -ac 2 -b 1500 -qscale 9 -r 15 -s 320*240 %1\video\%Path%\%3.flv
C:\ffmpeg.exe -i %2 -y -f image2 -ss 8 -sameq -t 0.001 -s 320x240 %1\video\%Path%\%3.jpg
del %2
endlocal
:Convert1 SitePath FullFile FileName
setlocal enableextensions
set file=%3
set Path=%file:~-14,6%
IF NOT EXIST %1\video\%Path% mkdir %1\video\%Path%
C:\mencoder.exe %2 -o %1\video\%Path%\%3.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=200:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=320:240 -ofps 12 -srate 22050
C:\ffmpeg.exe -i %2 -y -f image2 -ss 8 -sameq -t 0.001 -s 320x240 %1\video\%Path%\%3.jpg
del %2
endlocal
:END
另外,mencoder支持rm和rmvb格式,所以顺便在这个批处理里加上了。
mencoder下载:
http://www.llbbll.com/?uid-1145-action-viewspace-itemid-990
或从mplayer中提取:
http://www5.mplayerhq.hu/MPlayer ... -mingw32-1.0rc1.zip
官方资源地址:
http://www5.mplayerhq.hu/MPlayer/releases/win32/
不过有个问题我用下面的语句进行测试
C:\>mencoder.exe D:\website\MySpace\video\temp\jhb.rm -o D:\website\MySpace\vide
o\temp3.flv -of lavf -lavfopts i_certify_that_my_video_stream_does_not_use_b_fr
ames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=20
0:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=320:2
40 -ofps 12 -srate 22050
MEncoder 1.0rc1-3.4.2 (C) 2000-2006 MPlayer Team
CPU: Intel(R) Celeron(R) CPU 2.40GHz (Family: 15, Model: 3, Stepping: 4)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
Compiled with runtime CPU detection.
success: format: 0 data: 0x0 - 0x815b5
REAL file format detected.
Stream description: Video Stream
Stream mimetype: video/x-pn-realvideo
Stream description: Audio Stream
Stream mimetype: audio/x-pn-realaudio
Stream mimetype: logical-fileinfo
VIDEO: [RV40] 632x420 24bpp 29.000 fps 0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:11 fourcc:0x30345652 size:632x420 fps:29.00 ftime:=0.0345
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 44.1 kbit/3.12% (ratio: 5512->176400)
Selected audio codec: [ffcook] afm: ffmpeg (FFmpeg COOK audio decoder)
==========================================================================
** MUXER_LAVF *****************************************************************
You have certified that your video stream does not contain B frames.
REMEMBER: MEncoder''s libavformat muxing is presently broken and will generate
INCORRECT files in the presence of B frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [scale w=320 h=240]
==========================================================================
Opening video decoder: [realvid] RealVideo decoder
Error loading dll
ERROR: Could not open required DirectShow codec drvc.so.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Error loading dll
ERROR: Could not open required DirectShow codec drv4.so.6.0.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Error loading dll
ERROR: Could not open required DirectShow codec drv43260.dll.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Opening video decoder: [realvid] RealVideo decoder
Error loading dll
ERROR: Could not open required DirectShow codec drvc.bundle/Contents/MacOS/drvc.
Read the RealVideo section of the DOCS!
VDecoder init failed :(
Cannot find codec matching selected -vo and video format 0x30345652.
Read DOCS/HTML/en/codecs.html!
======================================================
出错的部分我用黑色粗体表示出来了。
解决的办法就是到http://www.mplayerhq.hu/design7/dload.html 下载其中的Binary Codec Package
然后解开压缩包,把其中的drv43260.dll copy到windows/system32/ 下面
然后 开始->运行 regsvr32 drv42360.dll 已经成功输出 !!!! 搞定打开flv 果然效果是可以的