Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st December 2011, 17:36   #1  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
x264+aac+mkv Batcher v0.18 ;)

EDIT: I deleted my questions in this first post and I am adding fruits of my work (with huge help of guys in this thread) for whoever might wanna use it.
Updates
Hi, guys, muxing stopped to work after I upgraded mkvmerge. Just letting you know, before I figure it out and publish update. Probably some change in CLI syntax, which is really not what I would expect.
Batch VAMD.18.rar + ini-file, sourcefilter-file, lot of small improvements
Batch VAMD.15.rar
What it does:
- gets filelists with name like list23.txt, where 23 is desired encoding quality (in the list can be various types of video files and also *.avs files!)
- processes the listed files in "test"or "full" mode as set at the beginning of the batchfile
- autocrops video
- resizes video to mod16 or whatever mod you like
- encodes with x264 at constant quality according your wish
- logs parameter to adjustments file where it can be overriden for the next pass (for example autocrop is applied only first pass, next time it uses parameters from the adjustments file)
- converts audio to 48000kHz
- encodes with neroaacenc
- removes the (annoying and everywherebeing) neroaacenc delay, so the audio and video are perfectly in sync (unless there is other reason for being out of sync)
- muxes audio and video to mkv
- deletes some intermediate files
- creates lot of files with lot if info, warnings and error reports (thats why I recommend it to run from empty directory)
What it does not...todo's?:
- MPEG2Source not yet implemented (could be done via directsource but I would prefer not to, but I havent figured that yet ...maybe something like Call (DGDecode)?)
- aspect ratio not kept if the source is anamorph...need to get that info from mediainfo and feed it to avs somehow
- additional filtering and deinterlacing

NEEDS:
bat:neroaacenc, x264, mkvtoolnix, wavi,
avs:Autocrop,masktools2,RedAverage

FIRST TIME:
put files to some directory where you'll keep it safe.
In Batch VAMD.18.bat replace the path to VAMD.ini.bat file, in the VAMD.ini.bat file set all the parameters relevant for your comp.

USAGE:
1. create file list to encode (you can use make_dirs.bat for that purpose)
2. split the list into files named list??.txt (like list20.txt, list25.txt) where ?? stands for encoding quality
3. in the beginning of the ini file write SET process="test"
this will enable fast first run to create encoded samples of the sources
4. run the batch file (the batch produces video and various other files) (lists need to be in current directory)
5. look on the results. If you are not satistied you can override values of processing for each file in SourceFilter.avsi and adjustmentsX_?.avsi
look also into file dim*.txt where you see some warnings and report and also look into other files produced in the working directory.
6. change the values in SourceFilter.avsi and adjustmentsX_?.avsi if necessary, change SET process="full" and run again, and again and again (or you can run test twice)
7. if you wanna reencode some file, you need to delete it
8. if there was error encoding a file, the excact avs script which caused the error is copied to the source file directory and you can open it in some previewer and editor to see what happened. Mostly the problem is codecs if tyou have some exotic source.
9. the automatically created adjustmentsX_?.avsi format is basically set of avisynth expressions delimited with $$ so feel free to write there whatever you want if you know the consequence. It is applied immediately after opening the file, cropping and everything else happens after.
10. the automatically created SourceFilter.avsi format is source filter decided in form of string strSF="FFVideoSource(srcfile, threads=1)" etc to eval()

EXAMPLE 1:
You have lot of videos from your digital camera. You run in test mode and for each file is created line in adjustmentsX. But, one of your video you were shooting with camera vertically (turned 90 degree). So, you find the line for that specific video, change it as below. If you are not sure, you can delete the sample video and run again.
Code:
"cl=0 $$ ct=0 $$ cr=0 $$ cb=0 $$ modx=16 $$ mody=8 $$ maxwidth=1280 $$ fpsn=1000000 $$ fpsd=33333 $$ ovrsize=0 $$ logadj=0 $$ ACMode=-1 $$ " #before
"TurnRight() $$ cl=0 $$ ct=0 $$ cr=0 $$ cb=0 $$ modx=16 $$ mody=8 $$ maxwidth=1280 $$ fpsn=1000000 $$ fpsd=33333 $$ ovrsize=0 $$ logadj=0 $$ ACMode=-1 $$"  #after
FILE FORMAT:
Code:
cl=0 $$ ct=0 $$ cr=0 $$ cb=0 $$ modx=16 $$ mody=8 $$ maxwidth=1280 $$ aw2=640 $$ ah2=360 $$ aw3=640 $$ ah3=360 $$ fpsn=22800 $$ fpsd=1001 $$ ovrsize=0 $$ logadj=0 $$ ACMode=-1 $$ # showcrop=1
crop...                           modulo dim...        downsize?        display dim...         resize dim...         framerate...               size override? log this line again?  autocrop?
CUSTOMIZATION OF SOURCE FILTER:
It you wanna change the way the script reads input video you have three options:
1. Change SourceFilterTmp.txt - here is how is source handled by default.
2. Change function ChooseMediaFilter() in video_processing_fileX.txt. This is how the video is handled if there is no default settings in 1. or if there was error and retryerr=true in the ini file.
3. Change SourceFilter.avsi which is the file imported during processing. For example add lines like this (strSF should contain the source filter):
Code:
strSF=(srcfile!="path1.mp4") ? strSF 
       \ : "DirectShowSource(srcfile)"
strSF=(srcfile!="path2.mpg") ? strSF 
       \ : "MPEG2Source(path2.d2v)"
CUSTOMIZATION OF PROCESSING:
1. You can change adjustmentsX_?.avsi in following way: Find the line which is related to particular source you want to process differently and you can:
a) change crop via c?=x
b) change modulo resizing via mod?=x
c) AssumeFPS via setting fps?=x
d) override resizing via a??=x and setting ovrsize=1
e) enable autocrop with ACMode=0
f) add any avs commands to the line separated by $$ as in example 1
g) enable to log new parameters to the file with logadj=1 (this will override the settings in f)
Running these changes is recommended in test mode first.
2. Change video_processing_fileX.txt preferably in the dedicated area, like #[universal progressive filtering here] etc

Last edited by redfordxx; 20th December 2011 at 06:55.
redfordxx is offline   Reply With Quote
Old 1st December 2011, 17:41   #2  |  Link
mbcd
Registered User
 
Join Date: Dec 2008
Location: Germany
Posts: 173
I searched such way too.

You can go another way.

Make a fixed name for videofile in avs-script e.g. "video.wmv".

When you want to convertt a file copy them into dir with avs-script and rename it to "video.wmv".

For this example it works, but of course not for other parameters in your avs-script.
mbcd is offline   Reply With Quote
Old 1st December 2011, 18:25   #3  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Code:
for %%A in (*.wmv) do call :encode %%A
goto:eof

:encode
:: %1 - file to encode
(
    echo FFVideoSource^("%1", threads=1^)
    type basic_processing_file.txt
) > tmp.avs
"C:\Program Files (x86)\MeGUI\tools\x264\x264_64.exe" --crf 23.0 --output "%~n1.mkv" tmp.avs
goto:eof

Last edited by gyth; 1st December 2011 at 18:36.
gyth is offline   Reply With Quote
Old 1st December 2011, 18:27   #4  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally Posted by mbcd View Post
When you want to convertt a file copy them into dir with avs-script and rename it to "video.wmv".

For this example it works, but of course not for other parameters in your avs-script.
Interesting...do you maybe happen to have still somewhere the batch file or something you used handy as a starting example for me?
redfordxx is offline   Reply With Quote
Old 1st December 2011, 22:27   #5  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally Posted by gyth View Post
Code:
for %%A in (*.wmv) do call :encode %%A
goto:eof

:encode
:: %1 - file to encode
(
    echo FFVideoSource^("%1", threads=1^)
    type basic_processing_file.txt
) > tmp.avs
"C:\Program Files (x86)\MeGUI\tools\x264\x264_64.exe" --crf 23.0 --output "%~n1.mkv" tmp.avs
goto:eof
OMG I have to take day off on this... ;-)

Last edited by redfordxx; 1st December 2011 at 22:29.
redfordxx is offline   Reply With Quote
Old 2nd December 2011, 00:49   #6  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Code:
for %%A in (*.wmv) do call :encode %%A
*.wmv makes a list of all the .wmv files in the directory the batch file is called from.
The for loop calls the encode function on each of the files.

Code:
goto:eof
This indicates that the main function is done.

Code:
:encode
This is a label, it marks the start of the encode function.

Code:
:: %1 - file to encode
This is a comment, it indicates that the function has one argument, the file to be encoded.

Code:
(
This marks the start of a block.

Code:
    echo FFVideoSource^("%1", threads=1^)
This is the first line of your "generalVideoscript.avs" file.
%1 is one of the file names being passed in from the for loop.

Code:
    type basic_processing_file.txt
Instead of echoing each line of "#some basic processing here", just have it in a text file.

Code:
) > tmp.avs
This closes the block and catches any output to the tmp.avs file.

Code:
"C:\Program Files (x86)\MeGUI\tools\x264\x264_64.exe" --crf 23.0 --output "%~n1.mkv" tmp.avs
This gets x264 to encode the .avs we just made.
%~n1 is the base name of the .wmv, the base name of File1.wmv is File1

Code:
goto:eof
This ends the function.
gyth is offline   Reply With Quote
Old 2nd December 2011, 16:28   #7  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Thank you, the most confusing was goto:eof, I assumed it means goto endoffile.
So, I guess when it is in function, it returns to the calling place, right?
redfordxx is offline   Reply With Quote
Old 2nd December 2011, 17:10   #8  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
So I ended up with following script, which does the job.
Code:
del all.log
for %%A in (*.wmv) do call :encode %%A
goto:eof

:encode
:: %1 - file to encode
echo ******************************************************************************  >> all.log
echo %1 >> all.log
echo ******************************************************************************  >> all.log
echo *  >> all.log
echo *  >> all.log
(
    echo LoadPlugin^("C:\Program Files (x86)\MeGUI\tools\ffms\ffms2-x64.dll"^)
    echo FFIndex^("%1"^)
    echo FFVideoSource^("%1", threads=1^)
    type basic_video_processing_file.txt
) > tmp.avs

(
    echo LoadPlugin^("C:\Program Files (x86)\MeGUI\tools\ffms\ffms2.dll"^)
    echo FFIndex^("%1"^)
    echo FFAudioSource^("%1", 0^)
    type basic_audio_processing_file11.txt
) > tmpa.avs

"C:\Program Files (x86)\MeGUI\tools\x264\x264_64.exe"  --crf 23.0 --bframes 8 --b-adapt 2 --ref 8 --qpmin 10 --qpmax 51 --subme 10 --partitions all --trellis 2 --sar 1:1 --output "%~n1.video.mkv" tmp.avs >> all.log
"C:\Program Files (x86)\MeGUI\tools\besplit\wavi.exe" "tmpa.avs" - | "C:\Program Files (x86)\MeGUI\tools\neroaacenc\neroaacenc.exe" -q 0.15 -if - -of "%~n1.audio.mp4" >> all.log
"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvmerge.exe" -o "%~n1.new.mkv"  "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-d" "1" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "%~n1.video.mkv" "--sync" "1:-128" "--forced-track" "1:no" "-a" "1" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "%~n1.audio.mp4" "--track-order" "0:1,1:1" >> all.log
"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvmerge.exe" -o "%~n1.audio.mka"  "--forced-track" "1:no" "-a" "1" "-D" "-S" "-T" "--no-global-tags" "%~n1.audio.mp4" "--track-order" "0:1" >> all.log
"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvinfo.exe" "%~n1.audio.mka" >> all.log
del "%~n1.video.mkv"
del "%~n1.audio.mka"
echo *  >> all.log
echo *  >> all.log
echo *  >> all.log
goto:eof
But there are still improvements possible and I appreciate your further help:
1 Spaces in filenames: %1 seems to have really problem with that. It returns only the part of the filename before first space. How to solve it?
2 Filelist as an input: how should I modify the script to process files in a filelist I specify, instead of *.wmv? The filelist will be something like dir * /b/s > f.txt and then manually deleted files which I dont want to process.
3 Logging x264 and neroaacenc do not write to the logfile. I think it is because they do not output text report to stdout but to stderr...my guess... is there anything to do with tthat?
4 Deleting I am deleting the intermediate video file. However, if there is a problem in muxing (it means *.new.mkv doesnot exist) I want to keep it. How to do it?
5 If I want to filter the output of mkvinfo and for example to log only line, which contains only one of these expressions "+ Duration:", "+ Default duration:" and "ChapterTimeStart", how to do that.
6 Is it possible to have date and time as a part of the name of the logfile?
7 In the avs script I will resize the video to 1280x???, if it is bigger, while keeping the size otherwise. Since I have to stick to mod 16, that can introduce aspect ratio error. I will calculate that error or the correct display dimensions in avs, but how do I pass it to x264 or mkvmerge?

BTW I am on Win7, in case it matters.

I am sorry, lot of question. I you dont have time, please at least number one, which is critical.
Thank you again

Last edited by redfordxx; 2nd December 2011 at 17:12.
redfordxx is offline   Reply With Quote
Old 2nd December 2011, 17:54   #9  |  Link
splinter98
Registered User
 
Join Date: Oct 2010
Posts: 36
Quote:
Originally Posted by redfordxx View Post
1 Spaces in filenames: %1 seems to have really problem with that. It returns only the part of the filename before first space. How to solve it?
Use "%~1" instead of "%1"
if %1 contains spaces it should automatically have ", however %~1 removes the " so "%~1" will ensure all paths are inside
Quote:
Originally Posted by redfordxx View Post
2 Filelist as an input: how should I modify the script to process files in a filelist I specify, instead of *.wmv? The filelist will be something like dir * /b/s > f.txt and then manually deleted files which I dont want to process.
try using: For /F %%A in (f.txt) do call :encode %%A
Quote:
Originally Posted by redfordxx View Post
3 Logging x264 and neroaacenc do not write to the logfile. I think it is because they do not output text report to stdout but to stderr...my guess... is there anything to do with tthat?
Use 2>> all.log instead of >> all.log - 2> redirects stderr
Quote:
Originally Posted by redfordxx View Post
4 Deleting I am deleting the intermediate video file. However, if there is a problem in muxing (it means *.new.mkv doesnot exist) I want to keep it. How to do it?
Use:
Code:
IF EXISTS "%~n1.new.mkv" do (
del "%~n1.video.mkv"
del "%~n1.audio.mka"
)
This checks if the *.new.mkv exists and then deletes the intermittent files
Quote:
Originally Posted by redfordxx View Post
5 If I want to filter the output of mkvinfo and for example to log only line, which contains only one of these expressions "+ Duration:", "+ Default duration:" and "ChapterTimeStart", how to do that.
You need some from of grep - not sure the best way to do that in batch files (one method probably would be to get a windows version of grep and then pipe the output to grep before putting into the log file)
Quote:
Originally Posted by redfordxx View Post
6 Is it possible to have date and time as a part of the name of the logfile?
%TIME% will give you the current time - so maybe a function like:
Code:
:timelog
echo %TIME% %1 >> log.txt
goto:EOF
Quote:
Originally Posted by redfordxx View Post
7 In the avs script I will resize the video to 1280x???, if it is bigger, while keeping the size otherwise. Since I have to stick to mod 16, that can introduce aspect ratio error. I will calculate that error or the correct display dimensions in avs, but how do I pass it to x264 or mkvmerge?
Code:
set /A height=<calculation>
will create a variable %height% with the result of <calculation>

NOTE: I haven't tested most of the code here but they should work - if not try typing the the command (so if,for etc) followed by a /? to get the help from these commands.

Last edited by splinter98; 2nd December 2011 at 17:57.
splinter98 is offline   Reply With Quote
Old 2nd December 2011, 19:31   #10  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
1]
Code:
    echo FFIndex^("%~1"^)
doesnot help...

3] 2>> gives me line per line progress of the encoding...so I guess this is not the way, but its not that important

6] but I meant the time part of the filename. Like
echo text >> log_2011-12-02-10-00.txt

btw: What exactly %~n1 does? Seems like the name part of the file.
But what when there is whole path in the variable?
redfordxx is offline   Reply With Quote
Old 2nd December 2011, 19:43   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
From Command Prompt type "help for".

EDIT: or eg, 'help for >c:\For.txt'
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd December 2011 at 19:46.
StainlessS is offline   Reply With Quote
Old 2nd December 2011, 19:43   #12  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Code:
for %%A in (*.wmv) do call :encode %%A
If there are spaces in the file names then you need to quote the second %%A, then use %~1 to removes the quote in the encode function.
Code:
for /F %%A in (f.txt) do call :encode "%%A"

Last edited by gyth; 2nd December 2011 at 19:49.
gyth is offline   Reply With Quote
Old 2nd December 2011, 20:08   #13  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Quote:
Originally Posted by redfordxx View Post
6] but I meant the time part of the filename. Like
echo text >> log_2011-12-02-10-00.txt
Here is a rewrite of some code I found at http://www.dostips.com
Code:
@echo off
call :log_name log
echo %log%
pause
goto:eof


:log_name
:: %1 - variable that the log name will be returned to
SETLOCAL
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('"echo.|date"') do (
    for /f "tokens=1-3 delims=/.- " %%A in ("%date:* =%") do (
        set %%a=%%A&set %%b=%%B&set %%c=%%C))
set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"
for /f "tokens=1-4 delims=:. " %%A in ("%time: =0%") do set log_name=log_%yy%-%mm%-%dd%-%%A-%%B-%%C-%%D.txt
ENDLOCAL & SET %~1=%log_name%
goto:eof
So set the log_name before the for and redirect everything to it >> %log%
Code:
call :log_name log
for /F %%A in (f.txt) do call :encode "%%A"
goto:eof

:encode
:: %1 - file to encode
echo ******************************************************************************  >> %log%
...

Last edited by gyth; 2nd December 2011 at 20:16.
gyth is offline   Reply With Quote
Old 2nd December 2011, 21:26   #14  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Quote:
Originally Posted by redfordxx View Post
7 In the avs script I will resize the video to 1280x???
x264 can resize
--video-filter resize:1280,,,width
but that would upsize things smaller than 1280 as well.

Code:
"C:\Program Files (x86)\anrichan3.3\x264.exe" "%~nx1" --frames 1 -o NUL 2>tmp.txt
:: avs [info]: 1920x1080p 0:0 @ 60001/1001 fps (cfr)

FOR /F "tokens=3 delims=x " %%B IN ('TYPE tmp.txt ^| FIND "avs [info]: "') DO (
    SET vf=
    if %%B GTR 1280 SET "vf= --video-filter resize:1280,,,width "
)
Add %vf% to your x264 line, if the width is greater than 1280 it will be set and do the resizing.

Hum, but that doesn't seem to set the SAR right. It gets as close to 1:1 as it can (mod8?) and then sets it to 1:1 even it is a little bit off.
Resizing to 1280x720 "--video-filter resize:1280,720" gets the SAR set correctly, but it is possibly far from square pixels depending on how wacky your sources are.
gyth is offline   Reply With Quote
Old 2nd December 2011, 23:11   #15  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
EDIT:Ooops, I didn't refresh the browser since your post 12. So maybe here is something off.

Well here is the script as of now in case anyone finds this thread and would like to use it
Code:
@IF EXIST batchlog.log del batchlog.log
@IF EXIST all.log      del all.log


@for %%A in (*.wmv) do call :encode "%%A"
::@for /F "tokens=* " %%A in (list.txt) do call :encode "%%A"


@goto:finish

:encode
:: %1 - file to encode
@IF EXIST "%~dpn1.new.mkv" (
    echo *********************************************************  >> batchlog.log
    echo "%~dpn1.new.mkv" exists and was fully skipped >> batchlog.log
    echo *********************************************************  >> batchlog.log
    goto:eof)
@echo *********************************************************  >> all.log
@echo %1 >> all.log
@echo *********************************************************  >> all.log
@echo *  >> all.log
@echo *  >> all.log
@( 
    echo LoadPlugin^("C:\Program Files (x86)\MeGUI\tools\ffms\ffms2-x64.dll"^)
    echo FFIndex^("%~1"^)
    echo FFVideoSource^("%~1", threads=1^)
    type "D:\video\_process\_processing\basic_video_processing_file.txt"
) > tmp.avs
@IF EXIST "%~dpn1.video.mkv" (
    echo *********************************************************  >> batchlog.log
    echo "%~dpn1.video.mkv" exists and was not encoded >> batchlog.log
    echo *********************************************************  >> batchlog.log
) ELSE (
    "C:\Program Files (x86)\MeGUI\tools\x264\x264_64.exe"  --crf 23.0 --bframes 8 --b-adapt 2 --ref 8 --qpmin 10 --qpmax 51 --subme 10 --partitions all --trellis 2 --sar 1:1 --output "%~dpn1.video.mkv" tmp.avs >> all.log
)
@(
    echo LoadPlugin^("C:\Program Files (x86)\MeGUI\tools\ffms\ffms2.dll"^)
    echo FFIndex^("%~1"^)
    echo FFAudioSource^("%~1"^)
    type "D:\video\_process\_processing\basic_audio_processing_file11.txt"
) > tmpa.avs

@IF EXIST "%~dpn1.audio.mp4" (
    echo *********************************************************  >> batchlog.log
    echo "%~dpn1.audio.mp4" was overwritten >> batchlog.log
    echo *********************************************************  >> batchlog.log
)
@"C:\Program Files (x86)\MeGUI\tools\besplit\wavi.exe" "tmpa.avs" - | "C:\Program Files (x86)\MeGUI\tools\neroaacenc\neroaacenc.exe" -q 0.15 -if - -of "%~dpn1.audio.mp4" >> all.log

@"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvmerge.exe" -o "%~dpn1.new.mkv"  "--language" "1:eng" "--default-track" "1:yes" "--forced-track" "1:no" "-d" "1" "-A" "-S" "-T" "--no-global-tags" "--no-chapters" "%~dpn1.video.mkv" "--sync" "1:-128" "--forced-track" "1:no" "-a" "1" "-D" "-S" "-T" "--no-global-tags" "--no-chapters" "%~dpn1.audio.mp4" "--track-order" "0:1,1:1" >> all.log
@"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvmerge.exe" -o "%~dpn1.audio.mka"  "--forced-track" "1:no" "-a" "1" "-D" "-S" "-T" "--no-global-tags" "%~dpn1.audio.mp4" "--track-order" "0:1" >> all.log
@"C:\Program Files (x86)\MeGUI\tools\mkvmerge\mkvinfo.exe" "%~dpn1.audio.mka" >> all.log
@IF EXIST "%~dpn1.new.mkv" (
    del "%~dpn1.video.mkv"
    del "%~dpn1.audio.mp4"
)
@del "%~dpn1.audio.mka"
@del "%~1.ffindex"
@echo *  >> all.log
@echo *  >> all.log
@echo *  >> all.log
@goto:eof

:finish
@pause
basic_audio_processing_file11.txt: this should be processed in case mkvinfo contains following string + ChapterTimeStart: 00:00:00.117000000
Code:
DelayAudio(11.0/1000.0)
SSRC(48000)
return last
basic_audio_processing_file31.txt: this should be processed in case mkvinfo contains following string + ChapterTimeStart: 00:00:00.097000000
Code:
DelayAudio(31.0/1000.0)
SSRC(48000)
return last
basic_video_processing_file.txt
Code:
o=last

w=o.width
w2=(w>1280 ? 1280 : w)
w3=((w2+15)/16)*16
w3=(w3>w ? w3-16 : w3)

h=o.height
h2=h*w2/w
h3=((h2+15)/16)*16
h3=(h3>h ? h3-16 : h3)

#display dimensions are w2 , h2

(w<=1280) ? o : o.BicubicResize(w3,h3,0,0.75)
So, for now I am leaving two things to manual work and todo later:
1) checking the nero's audiodelay (because it requires the grep function)
2) checking aspect ratio in case of resizing (the variable is calculated in avs environment and I have to use it in commandline)

But besides that, I think it does everything fine....thanks again

Last edited by redfordxx; 2nd December 2011 at 23:14.
redfordxx is offline   Reply With Quote
Old 2nd December 2011, 23:16   #16  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
@echo off
at the start will keep it from talking back at you without needing @s everywhere.
Code:
w3=((w2+15)/16)*16
w3=(w3>w ? w3-16 : w3)
Don't add 15 if you want it to round down.

Last edited by gyth; 2nd December 2011 at 23:22.
gyth is offline   Reply With Quote
Old 3rd December 2011, 00:15   #17  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
Quote:
Originally Posted by gyth View Post
@echo off
at the start will keep it from talking back at you without needing @s everywhere.
Code:
w3=((w2+15)/16)*16
w3=(w3>w ? w3-16 : w3)
Don't add 15 if you want it to round down.
If want to round up if that will not be bigger than original. That depends on whether the video is downsized.
redfordxx is offline   Reply With Quote
Old 3rd December 2011, 00:55   #18  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
the date and time thing seems to more or less work, but how the hell happened that the variables in this line
Code:
set /a "yy=10000%yy% %%10000,mm=100%mm% %% 100,dd=100%dd% %% 100"
have any value. They are nowhere before assigned...
redfordxx is offline   Reply With Quote
Old 3rd December 2011, 01:30   #19  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
Code:
set %%a=%%A
The capitalization matters there.
One of the for loops is going through yy, mm, dd while the other is their values.

This is used because not everyone uses the same date format; MM/DD/YYYY, YYYY/MM/DD, DD/MM/YYY

On my system it is
Code:
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('"echo.|date"') do (
:: The current date is: Fri 12/02/2011
:: Enter the new date: (mm-dd-yy)

    for /f "tokens=1-3 delims=/.- " %%A in ("%date:* =%") do (
:: 12/02/2011
gyth is offline   Reply With Quote
Old 3rd December 2011, 02:07   #20  |  Link
redfordxx
Registered User
 
Join Date: Jan 2005
Location: Praha (not that one in Texas)
Posts: 863
I see, so %%a is not variable here but it is name of the variable...this is crazy ;-)
btw, this %% modulo thing later destroys the leading zero, so I wonder why it is there...
redfordxx is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.