View Full Version : Xvid settings string in vdub jobs file
ikarus
20th May 2003, 21:56
Hi,
after opening a quite informative thread (for me) in the vdub section, the information i got there pointed me to the xvid section.
What i am trying to find out is, how i can manipulate xvid encoding settings in a vdub jobs file directly, without using the configuration dialouge in vdub.
Reason for this is, i encode lots of tv recordings, and i want to try to write a script that will do almost all work for me, plus write a vdub jobs file, so that i just run vdub with /r to start the jobs batch i created.
missing for this task is just one piece, that i cannot grasp alone, the xvid settings string.
decoding the string from the jobs file (base64 as i was told)
resulted in readable names for the stats and mvh files but not for codec settings.
i read in the xvid source code, but couldn't find how that string is set up :( im no programmer nor skilled in programming. So any help from pros is much appreciated.
i figured out that xvid has some encoder entry point, which is i suppose the function called with that string or parts of it, but it would be crucial to know which bits are for what parameter.
maybe some expert can give me a brief overview or at least another hint that helps me understand the mechanism.
thanks in advance
ikarus
You need to get the state of the codec, if your not a programmer I dont think there is going to be any easy way for you to do this.
Maybe one aspect you could try is editing the registry before each encode, you can set the parameters in there, without having to fiddle with getting xvid's state memory block and base64 en/decoding.
Although that isn't probably quite what you want, you may find useful info in threads to do with base64 try searching the forum for ones like:
http://forum.doom9.org/showthread.php?s=&postid=238654&highlight=base64#post238654
Cheers,
-Nic
hellgauss
20th May 2003, 22:16
download xvid.latest.tar.gz, and look for config.h
Be very carefull since this struct can changes in each build of xvid.
However vdub send to codec a 'bitstream' which the codec uses for settings.
The 'configuration' struct is a mix of 32bit integers, strings, floats, ecc...
This array of bits is converted in a mime64 string, so it can be put easily in a txt file like vdub's job.
Bye
HG
ikarus
20th May 2003, 22:35
thanks for the quick answer and further reading, but the base64 en/dcodeing is not really a problem.
what do you mean by "you need to get the state of the codec [..] from the memory" ?
i did anticipate that the settings i chose (i use koepis build, don't know if the interface in vdub is differnt to yours) were all written down in that string found in the vdub jobs file.
the thread you linked me to makes it quite clear for divx5, which seems to use its own cli arguments to "remember" what to do.
this is where the base64 encoded string (encoded by vdub) resolves to cli parameters for the divx5 codec.
unfortunately xvid doesnt seem to use a similar cli interface but seems to store its settings in raw binary/hex /whatever humanunreadable format.
i m not comfortable messing around with my registry if i can avoid it.so may i ask if you with your certainly good knowledge of xvid can tell me how the settings string is handled by xvid ?
i'd be very happy if you could give me a short (if possible) insight into this or at least some hints that may direct me to the right thoughts.
i`m not demanding a walktrough (im in no position to demand anything anyway), just some kick to the right direction. although i would be fine with details also ;)
as mentioned, im not a professional programmer but i am eager to understand the parts i can use.
thanks for taking the time
ikarus
stax76
20th May 2003, 23:30
it would be better you config the codec with the registry!
Its exactly as hellgauss stated (very well & concisely I may add). The big struct that xvid uses is just used as a memory block and base64 encoded as a string to be fed into virtualdub.
i.e. you create an instance of that struct, fill it with the variables you want, base64 it, and then your done.
I still don't think the above is what your looking for, because it is a "complicated" solution. But I think it may be the best you get.
Hope its of some use at least,
-Nic
ikarus
21st May 2003, 02:06
@hellgauss:
well, i have been told that in the vdub section already, the information i was looking for here is what part of that string is used to store what setting, e.g. position 1-8 encode bitrate, position 9 encodes this, pos 9 that other toggle.
i have been reading the xvid source, but well as i said im not a programmer so that code is not an open book to me as it would for a programming pro.
@dolemite
well it may be the easier way to toggle the settings, still i would have to add some regserv commands (dont know how this works yet, but im sure won't be hard to find out) plus, as far as i understand i`d have to alter these settings in the registry befor each encoding procedure. so i`d have to implement a batch processing in my own script since i can't control that once vdub runs a joblist, can i ?
@nic
that was exactly what i planned, create that struct as it is done by the vdub config dialouge of xvid, base64 it, write it to the jobs file.
but, as stated before, i need to know the strcuture of that struct.
since i am obviously not skilled enough in C, i cannot read it from the sources, so i was hoping to get some help here.
i thought as an xvid binary creator you might have had some insight that i do not. maybe some hint on how to read the sources to find what i need is already sufficient. up to now i sadly only managed to identify some single parameters, but not what i need, the arrangement of those in the settings string or memory block as you say.
i hope i made myself a bit clearer now, since i have a feeling of having been misunderstood a little.
all suggestions and hints welcome
thanks
ikarus
hellgauss
21st May 2003, 08:50
@ikarus
Let's do an example:
There is a codec that has this three parameters:
int bitrate; //this is 4 byte=32 bit
float quantizer; //other 32 bit
char statsfile[20];//20*8=160 bits, since 1 char=8bit
total=224 bits
write this bits in an array like 10111001010101.....
Then divide it in groups of 6:
101110 010101 01....
And transform each group with the mime64 character. Then write this characters string in vdub job
read config.h file to know how this struct is done
Bye
HG
ikarus
24th May 2003, 18:59
thanks for the help
@hellgauss: a friend explained that integer stuff further to me, i think understood now. i`ll go for some testing now.
if anyone is interested, i think i`ll post my proceedings/results here
regards
ikarus
norxh
27th May 2003, 03:34
This might possibly help ya. Its a little snippet from a larger batch processing system I wrote. This is actually just windows shell script (.bat)::Do the encodes
Q:
::First pass
If Exist Q:\video.stats (Del Q:\video.stats)
regedit /s Pass1.reg this just kills the old stats file and quietly loads my standard first pass xvid settings.Copy /Y Encode.jobs.template1 "C:\vd\vdmod\VirtualDubMod.jobs"
C:This copies a job file to the standard Virtualdubmod jobs file. It just says to encode my fully processed source file. I took out the setcompdata command from the job, so that my settings from the .reg would remain in the registry.Cd "C:\vd\vdmod"
Start /wait virtualdubmod /x /r This runs that first pass job, and waits for virtualdub to finish.::Second Pass
Q:
regedit /s Pass2.reg
Duration2 Buffer\Cleaned.avi Buffer\Audio.mp3
Copy /Y Encode.jobs.template2 "C:\vd\vdmod\VirtualDubMod.jobs"
C:
Start /wait virtualdubmod /x /rIts basically the same deal for the second pass. Except this pass has duration2 which is a simple program i wrote to set the perfect desired size in xvids registry setting considering the avi overhead, duration, and the size of the audio.
The best way to get the reg setting is to just set them normally the run regedit and export HKEY_CURRENT_USER\Software\GNU\XviD. As for the job files, you create them like you would normally then just open the virtualdub jobs file in your text editor and take the parts you need. I found this easier with 1.4.13.2 than 1.5.*. You can save exporting wavs to job files and what not.
ikarus
28th May 2003, 00:31
thank you for your help, but as stated (i hope) initially, my task is a little more complex.
i record quite a bunch of different tv shows so i need some script that really does the main part of my work.
i am on my way to learn / get into perl in order to get that done.
i had some helping hand and got the xvid string figured out. now i am thinking on how to implement a module in perl that writes that string to a job file with values given from config files.
that will be the heart of my project. further elements will be:
- writing rest of the jobs file (to process a days or weeks crop of recordings at one time)
- starting vdub
before that:
- finding files by name (preset file)
- demuxing via pvastrumento jobs file
- encoding audio (settings taken from presets file)
- calculating video size
after encoding
- muxing files
- maybe create md5sums
i am sure some thing i find handy will come to my mind during the process.
all in all i think it will be my lifes work ;) - well i don't hope so
well still sitting at the core - that little "write my xvid settings" thing
wish me luck
ikarus
ikarus
18th September 2003, 23:49
Hi,
It has been some time, and i still didn't make it :(.
well, after a reinstall, i accidentially installed
XviD-24062003-1.exe instead of the last stable.
since i dont experience problems with it i plan on keeping it.
i had some friends help me with my initial task, so i managed to get that init string decipherd for the 04102002 build via "config.h"
the init struct for the new build however is longer, and i dont know on what core src this build is compiled.
so this is basically a question for Koepi himself:
where could i get the config.h for your most recent build ?
i`d really be happy to get my eyes on it, so i can possibly use the new build for my project.
kind regards
ikarus
hellgauss
19th September 2003, 11:11
I think that 24/6 bulid is like 14/5 one, in sending parameters.
Maybe the src you are looking for is in the daily snapshot at xvid.org.
However wait for koepi for a more correct answer :-)
Bye
HG
wertert
19th September 2003, 14:03
Hi
I have had a go and playing around with the codec string in the vdub file. Nothing very special but using perl things seem fairly straight forward. This is from a divx batch program but it should work with xvid.
take and existing string from a vdub config file that represents a set of known settings ie log files/ bitrate.... into $pass1Data
$pass1Data=old_decode_base64($pass1Data);
using regex subs swap the known sections for the values you want to use
$pass1Data =~ s/C:\\divx.log/$divxLog/i;
$pass1Data =~ s/C:\\test.divx/$divxtest/i;
$pass1Data =~ s/C:\\mvinfo.bin/$divxmvinfo/i;
$pass1Data =~ s/$out1/$out2/; # swap bitrate 999 for $out2
$infoSizePass1=length($pass1Data);
$pass1Data=old_encode_base64($pass1Data);
write this into the vdub config file and load into vdub.
Hope it helps
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.