Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- set "input=test.mkv"
- set "output=output.avi"
- set enable_colormatrix_conversion=0 %= like ColorMatrix(mode="Rec.709->Rec.601") =%
- set "matrix_convert="
- if %enable_colormatrix_conversion%==1 set matrix_convert=:matrixin=709:matrix=170m
- set vf_params=zscale=720:-16%matrix_convert%
- set common_params= ^
- -y -hide_banner ^%= overwrite files without prompt; hide ffmpeg banner =%
- ^%= =%
- -i "%input%" ^%= =%
- -t 10 ^%= 10s test sample =%
- ^%= =%
- -map 0:v:0 ^%= =%
- ^%= =%
- -vf %vf_params% ^%= =%
- ^%= =%
- -codec:v libxvid ^%= {parameter name in xvid_encraw = default value} =%
- -b:v 1100k ^%= {bitrate=700} =%
- -bf 2 ^%= {max_bframes=2} =%
- -g 300 ^%= {max_key_interval=300} =%
- -trellis 1 ^%= 0,1 [0] {notrellis=UNSET} =%
- -me_quality 6 ^%= 0..6 [4] {?quality=6} =%
- -mbd rd ^%= macroblock decision algorithm, [simple],bits,rd {?} =%
- -flags +aic ^%= H263 advanced intra coding/mpeg4 ac prediction {?} =%
- -qmin 2 ^%= ? 2..31 [2] ? =%
- -qmax 31 ^%= ? 2..31 [31] ? =%
- %= ΓΈ =% ^%= [ΓΈ],-lumi_aq,-variance_aq {masking=0} =%
- ^%= =%
- -bsf:v mpeg4_unpack_bframes^%= to improve hw compatibility {nopacked=UNSET} =%
- ^%= =%
- -f avi ^%= when can't be deduced from extension (NUL, pipe) =%
- -vtag XVID %= xvid->XVID somehow helps MediaInfo show more info =%
- set pass2_params= ^
- -map 0:a:0? ^%= map first audio track if exists (e.g. test videos =%
- -codec:a libmp3lame ^%= may have no audio) =%
- -b:a 128k %= =%
- ffmpeg %common_params% -pass 1 NUL || goto error_handler
- echo. & echo. & echo.
- set "FFREPORT=file=ffreport_%%t_%output%.log:level=32" %= only for 2nd pass =%
- ffmpeg %common_params% -pass 2 %pass2_params% "%output%" || goto error_handler
- call :cleanup
- pause & exit /b
- :error_handler
- call :cleanup
- echo. & echo ERROR: ffmpeg failed. Aborting... & pause & exit /b
- :cleanup (void)
- del ffmpeg2pass-0.log 2>NUL
- del xvidff.?????? 2>NUL %= log duplicated due to ffmpeg bug =%
- exit /b
- :: exact mapping to these options?
- :: ENCRAW: -quality integer : quality ([0..6]) (6)
- :: ENCRAW: -vhqmode integer : level of R-D optimizations ([0..4]) (1)
- :: https://github.com/ShiftMediaProject/xvid/blob/master/examples/xvid_encraw.c#L69 (some fork, only #line link matters)
- :: https://github.com/ShiftMediaProject/xvid/blob/master/examples/xvid_encraw.c#L2627
- :: is -me_quality mapped to them or to quality only or ...?
- :: FFMPEG: -me_quality motion estimation quality [0=no motion estimation]
- :: is -mbd mapped to -vhqmode or something?
- :: further reading:
- :: https://ffmpeg.org/ffmpeg-codecs.html#libxvid
- :: https://ffmpeg.org/doxygen/trunk/libxvid_8c_source.html
- :: http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/examples/xvid_encraw.c?view=markup
- :: https://superuser.com/questions/1483338/cant-get-same-xvid-quality-and-file-size-out-of-ffmpeg-as-mencoder
- :: https://forum.videohelp.com/threads/307131-Does-xvid-cli-(command-line-version-of-xvid)-actually-exist#post1891813
- :: https://forum.doom9.org/showthread.php?t=119399 (avs2qxvid.bat links are dead)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement