Hello! I am currently exploring XVID for my project. Being new in the area of encoders and decoders I would like to ask a question: Let's say I would like to edit the bitstreamputbits() function to write the bitstream to a file. The thing I am not sure about is if this were possible. That is because, if virtual dub were to use xvid to encode a movie, will the fprintf function work along side it? (This means during encoding, a file which i specified will be written as well with the bits I want). Not sure if i made myself clear!
--------------------- 2000 Z3 2.8 Schwarz II x III
Hey Thanks Nic! I am not proficient enough in C. fprintf only writes a text file? fwrite writes a binary file i suppose? Anyway, how do you guys test the source code once u edited the code? Meaning, if i edited the code, do i install the xvid.inf file again? It will overwrite the old one? And if i want to have different test versions? static void __inline BitstreamPutBit(Bitstream * const bs, const uint32_t bit) { if (bit) bs->buf
If all you want to do is capture the output of the encoder, why not edit the vfw code instead? All xvidcore does is write all its output to a buffer supplied by vfw, then vfw returns that buffer to the calling application (VDub then writes it to an AVI file). If you wrote out the contents of frame.bitstream (the length of which is frame.length) in vfw/src/codec.c -> compress() you'd achieve the same thing, and it'd work a lot faster than individual writes for every bitstring. And it'd save you a lot of trouble :) -h
--------------------- A good friend will bail you out of jail... But your BEST friend will be the one sitting next to you, saying; "That was freaking awesome!"
Editing the VFW's code is pretty new. So i will just fwrite the frame.bitstream from the compress() function of codec.c ? And if i wanted to write lets say 1 megabyte to each file (A 10 meg file produces 10 files etc). Is that still possible with VFW? If it were possible. How then can i decode? Is it with VFW too?
What is the end goal of this project? There are probably easy ways to solve the entire problem, instead of creating extra work at every step. -h
--------------------- A good friend will bail you out of jail... But your BEST friend will be the one sitting next to you, saying; "That was freaking awesome!"
The end goal is pretty experimental like. The idea is to speed up streaming. Just like how download accelerator and other download managers do it. Segment the file and download from different servers. Similarly, I want to apply it to video but perhaps on a frame by frame basis. So 10 consecutive frames are each stored in separate files. So file 1 has frame 1, 11 , 21 etc etc. That is my main purpose. But the thing is all frames have different sizes. Not sure if i can write each frame to each file. What do u suggest? Streaming function will be implement in the decoder( i suppose) and will just get the 10 different files from the 10 different servers.
I have got another question. If I were to write the bitstream from bitstream.h in the bitstreamputbit(), will this binary file of bitstream be playable in windows media player? Or do I have to do it in the VFW's source?
Yes, load balancing as well! So it would be easier to tap from "LRESULT compress(CODEC * codec, ICCOMPRESS * icc)" in codec.c of vfw. For each time the compress() function is called, it is one entire frame with its auxilliary information? Are frame.length, frame.bitstream the only things i need to write to? Which part of the function does it write these info? if (!WriteFile(codec->twopass.hints, &frame.hint.hintlength, sizeof(int), &wrote, 0)
Hey -h, I read the code for VFW, it prepares the video for writing by virtualDub and understood a little. Let me paint the impression in my mind: frame.bitstream in compress() now has the output compressed data to write. frame.length has the size of the compressed data However, how about things such as flags for the AVI index? Must they be written too? What else are they? Any order of writing? I have inserted this code: outfile = fopen("test.dat", "a+"); fwrite(frame.bitstream, sizeof(BITMAPINFOHEADER), frame.length, outfile); VirtualDub would crash! Think something is wrong but cant figure out where! Please help!:confused:
Hi! I have never used Linux before and was wondering after you "make" the xvid codec, do you still have to use a third party program like virtual dub to encode or will you produce a .exe file as the encoder?