its very simple, all u need to do is just drag 'n drop ur video file to the batch file, then it will run the video conversion automatically after the avisynth file generated.
minimum system/software requirements:
1. Windows XP SP2
2. Windows media player 11(for the latest version of windows media format runtime)
3. Windows media encoder
4. Avisynth, download url can be found on first page.
5. modified WME9 encoder script. info and download from doom9
6. hotfix for vista user only download
7. FFmpegsource(avisynth plugin that use ffmpeg) download link and infos
8. Notepad2, Optional, for easier batchfile editing.
9. Optional, xvid cli encoder Download/more info
10. Optional, x264 cli encoder Download, user who are using 32bit OS should choose x264_x86_rxxx.7z, 64bit OS user can either use x86 or 64bit(x264_x64_rxxx.7z)version too, but 64bit build is recommended.
11. Optional, FFmpeg, mp4box and helix mp3 encoder.
After downloaded all necessary files, extract all the files from ffmpegsource.rar/xvid_encraw.exe/wmcmd.vbs/x264.exe/hmp3.exe to C:\Program Files\AviSynth 2.5\plugins
save the code from below to a batch file, make sure the file extension is .bat, else its just a plain text file :x
remember, video encoding require powerfull cpu, its recommended to use multi-core/smp cpu, because codecs below are multithreaded.
complicated version:
CODE
@echo off
if "%~1"=="" goto die
del/s/q/f "%temp%\avs">nul:
md "%temp%\avs"
title Rojak Media Encoder [%1]
set path=%path%;C:\Program Files\AviSynth 2.5\plugins
set ff=%temp%\avs\%~n1.avs
if "%~1"=="%~dpn1.avs" set ff=%~dpn1.avs && goto pre
rem ffmpegsource
echo FFmpegSource("%~1", vtrack = -1, atrack = -1,vcachefile="%temp%\avs\%~n1.ffv",acachefile="%temp%\avs\%~n1.ffa",seekmode = 1)>>%ff%
rem DGDecode
rem start/b/w/low C:\"Program Files"\Neuron2\DGIndex.exe -FO=0 -TN=1 -OM=0 -IF=[%~1] -OF=[%userprofile%\desktop\%~n1] -exit
rem echo mpeg2source("C:\Users\user\desktop\%~n1.d2v",idct=7,cpu=0,upconv=0).hqdn3d()>>%ff%
:pre
set enc=
set audio=
if "%enc%"=="" set enc=wme
goto %enc%
:wme
set wma=-a_codec WMAPRO -a_mode 2 -a_setting 128_44_2_16
set wmv=-v_codec WVC1 -a_mode 3 -v_keydist 10 -v_bitrate 800000 -v_performance 60
set adv=-v_bframedist 2 -v_mslevel 4 -v_msrange 0 -v_mvcost 1 -v_mmatch 0 -v_dquantoption 3 -v_loopfilter 1 -v_percopt 3
start/b/w/low cscript C:\"Program Files\AviSynth 2.5"\plugins\WMCmd.vbs -input %ff% -output "%userprofile%\desktop\%~n1.wmv"
goto done
:x264
set aq=--aq-strength 0.5 --aq-sensitivity 0
set def=-b 3 --mixed-refs -B 400 --b-pyramid --weightb --b-bias 30
set x2=start/b/w/low x264 %ff% --thread-input --direct auto --progress --no-ssim --non-deterministic --keyint 600 %def% --no-psnr --me-prepass --8x8dct
set hq=-A all -r 5 -t 2 --bime -m 7 --b-rdo
set t1=-A p8x8,b8x8 -m 3 --me hex -r 2
set t2=-A none -m 1 --me dia -r 1
%x2% -p 1 --stats "%~dpn1.log" -o nul: %t1%
%x2% -p 2 --stats "%~dpn1.log" -o "%userprofile%\Desktop\%~n1.mp4" --no-fast-pskip --me umh %hq%
rem %x2% -o "%userprofile%\Desktop\%~n1.mp4" --no-fast-pskip --me umh --crf 32
goto audio
:xvid
set asp=-qpel -gmc -qtype 1
set hq=-quality 6 -vhqmode 4
set xd=start/b/w/low xvid_encraw -i %ff% -nopacked -lumimasking -progress 2 -bvhq -type 2 -bitrate 800
%xd% -pass1 "%temp%\avs\%~n1.log" -turbo
%xd% -pass2 "%temp%\avs\%~n1.log" -o "%temp%\avs\%~n1.avi"
start/b/w/low mp4box -add "%temp%\avs\%~n1.avi" "%userprofile%\Desktop\%~n1.mp4"
goto audio
:audio
if %enc%==wmv goto done
if %audio%==ture (goto here else goto done)
:here
set helix=hmp3 -V100 -X2 -U2 -Q-1 - "%temp%\%~n1.mp3"
set vorbis=oggenc -q 4 - -o "%temp%\%~n1.ogg"
start/b/w/low ffmpeg -i %ff% -vn -acodec pcm_s16le -f wav - | %helix%
start/b/w/low mp4box -add "%temp%\%~n1.mp3" "%userprofile%\Desktop\%~n1.mp4"
goto done
:done
echo Conversion done!
pause>nul:
:die
if "%~1"=="" goto die
del/s/q/f "%temp%\avs">nul:
md "%temp%\avs"
title Rojak Media Encoder [%1]
set path=%path%;C:\Program Files\AviSynth 2.5\plugins
set ff=%temp%\avs\%~n1.avs
if "%~1"=="%~dpn1.avs" set ff=%~dpn1.avs && goto pre
rem ffmpegsource
echo FFmpegSource("%~1", vtrack = -1, atrack = -1,vcachefile="%temp%\avs\%~n1.ffv",acachefile="%temp%\avs\%~n1.ffa",seekmode = 1)>>%ff%
rem DGDecode
rem start/b/w/low C:\"Program Files"\Neuron2\DGIndex.exe -FO=0 -TN=1 -OM=0 -IF=[%~1] -OF=[%userprofile%\desktop\%~n1] -exit
rem echo mpeg2source("C:\Users\user\desktop\%~n1.d2v",idct=7,cpu=0,upconv=0).hqdn3d()>>%ff%
:pre
set enc=
set audio=
if "%enc%"=="" set enc=wme
goto %enc%
:wme
set wma=-a_codec WMAPRO -a_mode 2 -a_setting 128_44_2_16
set wmv=-v_codec WVC1 -a_mode 3 -v_keydist 10 -v_bitrate 800000 -v_performance 60
set adv=-v_bframedist 2 -v_mslevel 4 -v_msrange 0 -v_mvcost 1 -v_mmatch 0 -v_dquantoption 3 -v_loopfilter 1 -v_percopt 3
start/b/w/low cscript C:\"Program Files\AviSynth 2.5"\plugins\WMCmd.vbs -input %ff% -output "%userprofile%\desktop\%~n1.wmv"
goto done
:x264
set aq=--aq-strength 0.5 --aq-sensitivity 0
set def=-b 3 --mixed-refs -B 400 --b-pyramid --weightb --b-bias 30
set x2=start/b/w/low x264 %ff% --thread-input --direct auto --progress --no-ssim --non-deterministic --keyint 600 %def% --no-psnr --me-prepass --8x8dct
set hq=-A all -r 5 -t 2 --bime -m 7 --b-rdo
set t1=-A p8x8,b8x8 -m 3 --me hex -r 2
set t2=-A none -m 1 --me dia -r 1
%x2% -p 1 --stats "%~dpn1.log" -o nul: %t1%
%x2% -p 2 --stats "%~dpn1.log" -o "%userprofile%\Desktop\%~n1.mp4" --no-fast-pskip --me umh %hq%
rem %x2% -o "%userprofile%\Desktop\%~n1.mp4" --no-fast-pskip --me umh --crf 32
goto audio
:xvid
set asp=-qpel -gmc -qtype 1
set hq=-quality 6 -vhqmode 4
set xd=start/b/w/low xvid_encraw -i %ff% -nopacked -lumimasking -progress 2 -bvhq -type 2 -bitrate 800
%xd% -pass1 "%temp%\avs\%~n1.log" -turbo
%xd% -pass2 "%temp%\avs\%~n1.log" -o "%temp%\avs\%~n1.avi"
start/b/w/low mp4box -add "%temp%\avs\%~n1.avi" "%userprofile%\Desktop\%~n1.mp4"
goto audio
:audio
if %enc%==wmv goto done
if %audio%==ture (goto here else goto done)
:here
set helix=hmp3 -V100 -X2 -U2 -Q-1 - "%temp%\%~n1.mp3"
set vorbis=oggenc -q 4 - -o "%temp%\%~n1.ogg"
start/b/w/low ffmpeg -i %ff% -vn -acodec pcm_s16le -f wav - | %helix%
start/b/w/low mp4box -add "%temp%\%~n1.mp3" "%userprofile%\Desktop\%~n1.mp4"
goto done
:done
echo Conversion done!
pause>nul:
:die
Note:
1. default video bitare is 800kbps, audio is 192kbps wma10(professional)/mp3 is vbr 160kbps, both are 2pass.
2. any comments/questions and suggestion are welcome, but pls ask on other forum instead(multimedia forum)
this encoder is a basic one, other fuctions like resize, crop, deinterlace and denoise can be added too, but will need to download more plugins.
3. the avisynth file is "embeded" into the batch file already, user can use thier own avisynth file too.
4. ffmpegsource can read tons of audio/video format/codecs, but some av codecs still missing eg real video and other weird format, if they have directshow codecs, user can switch to directshowsource.
5. if user have x264 or xvid cli encoder installed and wish to use it, just edit the batch file, goto line 4, eg, set enc=x264, then the encoder will switch to x264
6. if user choose either xvid or x264 encoder, the encoded file will be audio-less coz xvid and x264 is for encode video only. altough its possible to stream-copy the source audio to matroska(aka mkv) or mp4, but user will need to download mkvtoolnix or mp4box for muxing.
7. if user are using directshowsource and have ffdshow installed, make sure ffdshow are disabled else it gonna mess up ur encoding.
8. ffmpegsource and directshowsource cannot handle video codec that use Variable framerate(wmv,real video,quicktime video) directly, user need to use ConvertFPS to convert the source fps to constant fps.
9. Helix mp3 encoder is added, unfortunately nero aac encoder cant accept pipe, even the wav file created by ffmpeg, so user have to encode and mux the nero aac seperately.
10. ZOMG this encoder now become complicated already lol >_>
Mencoder experimental version:
CODE
@echo off
title Mencoder [%~1]
if "%~1"=="" goto eof
cd /d "c:\program files\mplayer"
set lame=-oac mp3lame -lameopts fast:preset=medium:mode=1:aq=2:q=4
set faac=-oac faac -faacopts tns:quality=75:object=2:cutoff=16000
set twolame=-oac twolame -twolameopts mode=jstereo:vbr=5:debug=4:maxvbr=224
rem filters below are for ivtc only.
set fd=-vf filmdint,hqdn3d -fps 30000/1001 -ofps 24000/1001
set ivtc=-vf softpulldown,ivtc=1 -fps 30000/1001 -ofps 24000/1001
set pu=-vf pullup,softskip -fps 30000/1001 -ofps 24000/1001
rem hardsubbing ass/srt does work, but without style, probably tweakable, quality depend on font/post processing filters used.
set m=start/b/w/low mencoder.exe %1 -msglevel all=5 -vfm ffmpeg -vf hqdn3d -sid 0 -embeddedfonts -subfont subfont.ttf -subfont-text-scale 3
set z7=start/b/w/low C:\"Program Files"\7-Zip\7z.exe e -so %1
echo %time%
rem ffmpeg codecs
set hq=vhq:v4mv:qpel:trell:cbp:qprd:mv0:mbd=2:dia=-1
set ffmp4=-passlogfile "ffmp4.txt" -ovc lavc -lavcopts autoaspect:vcodec=mpeg4:vmax_b_frames=3:keyint=300:b_sensitivity=10:vbitrate=700:lumi_mask=0.3:dark_mask=0.3:naq:vb_qoffset=1:vb_qfactor=1.4:vglobal=0:aglobal=0
rem xvid
set xvid=-ovc xvid -xvidencopts me_quality=6:qpel:trellis:chroma_opt:chroma_me:hq_ac:vhq=4:lumi_mask:quant_type=h263:nopacked:gmc:bvhq=1:autoaspect:threads=2:bitrate=700
rem x264
set x264=-passlogfile "x264.txt" -ovc x264 -x264encopts keyint=600:bframes=3:b_adapt:b_pyramid:deblock=0,0:cabac:direct_pred=auto:weight_b:8x8dct:chroma_me:mixed_refs:threads=0:aq_strength=1:aq-sensitivity=0:non_deterministic:b_bias=30:bitrate=700
rem libavcodec mpeg4 2 pass
rem %m% -o :nul -nosound %ffmp4%:vb_strategy=1:vpass=1:turbo
rem %m% -o "%userprofile%\desktop\%~n1.avi" %ffmp4%:%hq%:vpass=2 -oac copy
rem xvid 2pass
rem %m% -o :nul -nosound %xvid%:pass=1:turbo -passlogfile "xvid.txt"
rem %m% -o "%userprofile%\desktop\%~n1.avi" %xvid%:pass=2 -nosound -passlogfile "xvid.txt"
rem x264 2pass
%m% %x264%:pass=1:turbo=2 -nosound -o nul:
%m% %x264%:pass=2:me=umh:frameref=6:partitions=all:subq=7:bime:brdo:nofast_pskip:trellis=2 -o "%userprofile%\desktop\%~n1.avi" -oac copy
rem %m% %x264%:me=umh:crf=32:frameref=5:partitions=all:subq=7:bime:brdo:nofast_pskip:trellis=2 -o "%userprofile%\desktop\%~n1.h264" -nosound -of rawvideo
rem libavcodec snow
rem %m% -ovc lavc -lavcopts vcodec=snow:vstrict=-2:vpass=2:vbitrate=700:pred=0:cmp=2:subcmp=2:mbcmp=1:refs=2
echo %time%
pause>nul:
:die
title Mencoder [%~1]
if "%~1"=="" goto eof
cd /d "c:\program files\mplayer"
set lame=-oac mp3lame -lameopts fast:preset=medium:mode=1:aq=2:q=4
set faac=-oac faac -faacopts tns:quality=75:object=2:cutoff=16000
set twolame=-oac twolame -twolameopts mode=jstereo:vbr=5:debug=4:maxvbr=224
rem filters below are for ivtc only.
set fd=-vf filmdint,hqdn3d -fps 30000/1001 -ofps 24000/1001
set ivtc=-vf softpulldown,ivtc=1 -fps 30000/1001 -ofps 24000/1001
set pu=-vf pullup,softskip -fps 30000/1001 -ofps 24000/1001
rem hardsubbing ass/srt does work, but without style, probably tweakable, quality depend on font/post processing filters used.
set m=start/b/w/low mencoder.exe %1 -msglevel all=5 -vfm ffmpeg -vf hqdn3d -sid 0 -embeddedfonts -subfont subfont.ttf -subfont-text-scale 3
set z7=start/b/w/low C:\"Program Files"\7-Zip\7z.exe e -so %1
echo %time%
rem ffmpeg codecs
set hq=vhq:v4mv:qpel:trell:cbp:qprd:mv0:mbd=2:dia=-1
set ffmp4=-passlogfile "ffmp4.txt" -ovc lavc -lavcopts autoaspect:vcodec=mpeg4:vmax_b_frames=3:keyint=300:b_sensitivity=10:vbitrate=700:lumi_mask=0.3:dark_mask=0.3:naq:vb_qoffset=1:vb_qfactor=1.4:vglobal=0:aglobal=0
rem xvid
set xvid=-ovc xvid -xvidencopts me_quality=6:qpel:trellis:chroma_opt:chroma_me:hq_ac:vhq=4:lumi_mask:quant_type=h263:nopacked:gmc:bvhq=1:autoaspect:threads=2:bitrate=700
rem x264
set x264=-passlogfile "x264.txt" -ovc x264 -x264encopts keyint=600:bframes=3:b_adapt:b_pyramid:deblock=0,0:cabac:direct_pred=auto:weight_b:8x8dct:chroma_me:mixed_refs:threads=0:aq_strength=1:aq-sensitivity=0:non_deterministic:b_bias=30:bitrate=700
rem libavcodec mpeg4 2 pass
rem %m% -o :nul -nosound %ffmp4%:vb_strategy=1:vpass=1:turbo
rem %m% -o "%userprofile%\desktop\%~n1.avi" %ffmp4%:%hq%:vpass=2 -oac copy
rem xvid 2pass
rem %m% -o :nul -nosound %xvid%:pass=1:turbo -passlogfile "xvid.txt"
rem %m% -o "%userprofile%\desktop\%~n1.avi" %xvid%:pass=2 -nosound -passlogfile "xvid.txt"
rem x264 2pass
%m% %x264%:pass=1:turbo=2 -nosound -o nul:
%m% %x264%:pass=2:me=umh:frameref=6:partitions=all:subq=7:bime:brdo:nofast_pskip:trellis=2 -o "%userprofile%\desktop\%~n1.avi" -oac copy
rem %m% %x264%:me=umh:crf=32:frameref=5:partitions=all:subq=7:bime:brdo:nofast_pskip:trellis=2 -o "%userprofile%\desktop\%~n1.h264" -nosound -of rawvideo
rem libavcodec snow
rem %m% -ovc lavc -lavcopts vcodec=snow:vstrict=-2:vpass=2:vbitrate=700:pred=0:cmp=2:subcmp=2:mbcmp=1:refs=2
echo %time%
pause>nul:
:die
1. Mencoder is much easier, all filters are built-in, and it support lame/faac/twolame natively, unless you wana use external audio encoder with diffrent container.
2. now libavformat have matroska muxer(ffmpeg/mencoder), but muxed video file still broken, video track cant be detected(haali media spliter and mkvtoolnix), and its only playable on mplayer. use avi, or raw format instead if u wish to encode to mpeg4-sp/asp/avc
3. mencoder default output container is avi, just remux it to mkv with mkvtoolnix, for less container problem in the future? mpeg4 asp/h264 in avi container is not recommended, unless you are not using any b-frame.
4. any text after the "rem" word will be ignored by cmd, just remove the "rem" if you wana use other encoders, the default encoder in this batch file is x264, and was patched with variance AQ. mencoder will complain unknown options if your mencoder was compiled with unpatched x264, just remove aq_strength=1:aq-sensitivity=0 from bathc file above, or if u dont wish to use x264 variance AQ.
5. hqdn3d is high quality noise remover which is enabled for higher compression, just remove the "-vf hqdn3d" for faster encoding, or the video source is already noiseless.
6. hardssubing ass/srt require mencoder compiled with fontconfig iirc, and set up is abit troublesome.
This post has been edited by 1024kbps: Mar 31 2008, 02:54 AM
Oct 1 2007, 07:59 PM, updated 18y ago
Quote
0.0153sec
1.59
5 queries
GZIP Disabled