Log in

View Full Version : Batch Processing and File Selector Wanted Again


dum
8th November 2007, 21:01
I sorry that I'm coming back to this questions, but the links, which are listed in the sticky message above do not satisfy me, so please help. Does anyone know

1) REAL BATCH PROCESSING UTILITY for AviSynth. Not a template-based-millions-of-files-generator, not another kind of fake, but exactly batch-processor, which can be used with a list of filenames to be processed for example.

2) File selection utility, which will allow to open file dialog when loading the *.avs file and choose the video files (or may be even several files) to be processed.



May be I do not understand AviSynth's internals and it is impossible to create such utilities? If so - please tell me, why?

Alain2
9th November 2007, 01:43
From what you ask for, I think Avisynth Batch Scripter is doing the job..

dum
10th November 2007, 21:41
Thank you, I'll try. Someone know any other tool?

dum
10th November 2007, 21:53
I have checked Avisynth Batch Scripter. It is not the tool I need. I don't want to generate script for each file, basing on a template. I want, if possible, tool, which can process number of files, basing on the list of files and one script file.

Alain2
10th November 2007, 22:03
Arf ok but..
I used to use it to create all the avs / jobs with it (one for all mode)
and the .bat to process them all with vdub / x264 (all for one mode)

dum
10th November 2007, 23:30
can you give me an example of .bat you used?

Alain2
11th November 2007, 02:55
Hum I am not doing this anymore, but here is what I found somewhere on my hdd for the .bat:
@echo off
cd "%PATH%"

echo #
echo ########## Audio %CLIP% ##########
echo #

date /t
time /t
start /b /wait /belownormal "#" "D:\Al\Belight\BeSweet.exe" -core( -input "%CLIP%.ac3" -output "%CLIP%.wav" -6chwav -logfile "%CLIP%.log" ) -azid( -g 0.95 )

date /t
time /t
start /b /wait /belownormal "#" "D:\Al\Belight\neroAacEnc.exe" -br 128000 -2pass -if "%CLIP%.wav" -of "%CLIP%.mp4"

del "%CLIP%.wav"
del "%CLIP%.ac3"

echo #
echo ########## Lagarith %CLIP% ##########
echo #

date /t
time /t
start /b /wait /belownormal /min "#" "D:\Al\VirtualDubMod\VirtualDubMod.exe" /s"%CLIP%.jobs" /x

echo #
echo ########## avc 1 %CLIP% ##########
echo #

date /t
time /t
start /b /wait /belownormal "#" "D:\Al\x264\x264.exe" --keyint 250 --min-keyint 25 --scenecut 30 --bframes 2 --b-bias 0 --b-pyramid --ref 8 --filter -3:-1 --bitrate 1400 --qpmin 10 --qpmax 51 --qpstep 4 --ratetol 1.0 --vbv-maxrate 0 --ipratio 1.2 --pbratio 1.3 --chroma-qp-offset 0 --pass 1 --stats "avc.stats" --qcomp 0.60 --analyse all --direct temporal --weightb --me "hex" --merange 16 --subme 5 --b-rdo --mixed-refs --bime --8x8dct --trellis 2 --threads 1 --trellis 2 --no-psnr --progress -o "1.mkv" "%CLIP%_final.avs"

echo #
echo ########## avc 2 %CLIP% ##########
echo #

date /t
time /t
start /b /wait /belownormal "#" "D:\Al\x264\x264.exe" --keyint 250 --min-keyint 25 --scenecut 30 --bframes 2 --b-bias 0 --b-pyramid --ref 8 --filter -3:-1 --bitrate 1400 --qpmin 10 --qpmax 51 --qpstep 4 --ratetol 1.0 --vbv-maxrate 0 --ipratio 1.2 --pbratio 1.3 --chroma-qp-offset 0 --pass 3 --stats "avc.stats" --qcomp 0.60 --analyse all --direct temporal --weightb --me "umh" --merange 16 --subme 6 --b-rdo --mixed-refs --bime --8x8dct --trellis 2 --threads 1 --trellis 2 --no-psnr --progress -o "%CLIP%_new.mkv" "%CLIP%_final.avs"

del "1.mkv"
del "%CLIP%.avi"

date /t
time /t
start /b /wait /high "#" "D:\Al\MkvToolnix\mkvmerge.exe" -o "%PATH%\%CLIP%_final.mkv" --language 1:eng --default-track 1 --display-dimensions 1:16x9 -d 1 -A -S "%PATH%\%CLIP%_new.mkv" --language 1:eng -a 1 -D -S "%PATH%\%CLIP%.mp4" --track-order 0:1,1:1 --attachment-mime-type text/plain --attachment-name %CLIP%.avs --attach-file "%PATH%\%CLIP%.avs"
echo --------------------------
echo --------------------------
echo --------------------------

It's only a template for .bat generation, it supposes the files called up exist (prepared with abatchscript as well)

dum
11th November 2007, 23:33
Thank you.
Can someone else recommend any other tool?

Adub
12th November 2007, 00:37
I don't think there is any other tool, besides just plain creating a batch script to... well... batch script for you.

dum
13th November 2007, 01:02
What do you mean as "plain creation"?

dum
21st November 2007, 03:08
Ok, I get the idea.
And can anyone say anything about file selector for avisynth?

stevenca
7th April 2008, 08:21
Can you explain step-by-step what exactly it is you want? Maybe, with some minor adjustments, its a functionality I can add to the avisynth batch scripter...

gzarkadas
7th April 2008, 17:48
@dum. If I understood your intention correctly, you will need to do the following:

1. Get a win32 ffmpeg build (http://arrozcru.no-ip.org/ffmpeg_builds/) (prefer the gpl-static download, it has fewer files).

2. Create one folder that will contain the avs script and the ffmpeg executable & assoc. dlls. Copy all files from the \bin subfolder where your have unpacked ffmpeg to this folder.

2. Put the following lines at the start of your avs script:

src = Import("current_file.txt")
AviSource(src)

After that the "last" special variable will contain the source video (from the '''echo "%%f">current_file.txt''' line in step 3 below).

3. Write a simple batch file following the template below (assuming you named your avs file as "myscript.avs", else change the name as wished):

@echo off
set src_folder=%1
set dst_folder=%2
for %%f in (%src_folder%\*.avi) do (
echo "%%f">current_file.txt
ffmpeg -i myscript.avs -vcodec xvid -acodec mp3 -b 800kb -ab 128 %dst_folder%\%%~nf.avi
)

If you want to encode to another format and not xvid, look at the available options of ffmpeg. It will help if you type ffmpeg>options.txt in the command prompt and read the file with a text editor; it is quite long for a console screen. At the same url of step 1 there is also a handy utility, WinFF, which you can use to find out the correct ffmpeg command line for a number of presets.

4. Call the batch file (say you named it "batchenc.cmd") as:

batchenc <relative-path-to-source-folder> <relative-path-to-destination-folder>

It will help if you put the input/output avis to subfolders of the folder where the main avs script, the batch file and ffmpeg are. If for example you make an "input" and "output" folder respectively, then you just have to type:

batchenc input output


5. That's all. If the preparation steps are done properly, then after running batchenc you will have a nice set of encoded files filtered with the same settings :).

Note 1: with the same procedure you can also use other command-line encoders that support avs files such as avs2avi, etc. All is needed is to change the line that calls the encoder.

Note 2: If it is the case that you have a text file with a listing of filenames (one per line), then you should replace the for... line in the batch file (step 3) with:

for /F %%f in (%1) do (


and call the batch file (step 4) as:

batchenc <path-to-list-file> <relative-path-to-destination-folder>

If the listing contains also other items in each line look at the help in for command (type for /? at the command prompt) to see ways to accurately parse each line.

dum
7th April 2008, 18:09
stevenca

I just want to apply arbitrary *.avs script to the bunch (or just directory) of files. Assuming that script is started with:
AVISource("...")
I want the "..." to be replaced with the set of files consequently. The approach of using set-of-avs generators I assume as faulty.

gzarkadas

Thanks a lot for such a detailed explanation, I'll try, looks perspective and many new information.

gzarkadas
7th April 2008, 18:54
@stevenca,

I have just checked out Avisynth Batch Scripter btw (well, I didn't before because I am so command-line oriented :)) and I believe that if the power of its graphical interface is combined with a simple setting to encode on the fly (instead of storing to disk) the template-generated avs script then it will become a really great tool for massive automated batch encodings.

The only thing needed is an input dialog to specify the command line, with a special placeholder for the avs script, to run as a simple exec call to an external program - or the set of user-supplied command lines to choose from (just a greedy thought, don't take it too seriously :D). Please consider adding someday this option.

stevenca
6th May 2008, 22:09
@ gzarkadas
Can you explain me a little further? (maybe a small example)
Dont quite understand what you want. But if you think it would improve ABS, I would really consider adding the option (if I get what you mean that is ;))

gzarkadas
7th May 2008, 10:16
What I meant is roughly that:

In mode "One for All", to add a button "Run scripts". When pressed instead of generating AVS script files on disk, the application will:

save the corresponding avs (the one that currently saves on disk) in a temp location,
call the external encoder to encode on-the-fly the avs and produce the video clip,
delete the temporary avs,


The external encoder will be a command-line application; thus a settings-dialog is needed for the user to enter the command line. In this command line two special placeholders are needed for the temporary avs and the output file in order for BatchScripter to substitute them with the real filenames.

For example, using the ffmpeg call in the above posts and setting the placeholders to be %AVS% and %OUTPUT% (the later should not include the extension, only the full path and filename where currently the produced final avs would be stored; that way no knowledge of the encoder is needed), the user would have to provide the following command line:

ffmpeg -i %AVS% -vcodec xvid -acodec mp3 -b 800kb -ab 128 %OUTPUT%.avi


And (the greedy thought :)) if this all is done, extending the settings-dialog to store multiple command lines in a list and recall one of them for use is not much of an extra work, but adds a lot to functionality for the user: presets are stored once and afterwards just double-clicked to select the desired one.

smok3
7th May 2008, 11:08
dum, what i do is based around total commander as selecting gui;
a. there is a template avs which has 'film.avi' as the thing that will get replaced with selected file
b. there is bunch of encoders for which i have written more or less braindead batches which again will take those generated avs files as input (template in this case is encoder settings)
or
b2. there is watch-folder multi-node batch that will just check if the folder has some avs inside and forward that on to the encoder (which is working good enough for two machines having 3 cpus, so i can run 3 nodes for single-threaded encoders, like vp6) .

let me know if you need some details.