I'm trying to generate some compressed video files, so I've been
trying to figure out the Avifile library. I've had some success: I can
download AVIs from the net and play them with aviplay, and I can write
compressed AVIs from my own code. There's a lot to figure out, though,
especially on the subject of codecs, and I've ended up with a few
questions which don't seem to have obvious answers.

Q1: I'd like to create AVIs which can be played by a normal Windows
machine. Are there any codecs I should avoid, or are they all found on
typical Windows installations? I'd rather not have to tell people to
download and install a codec to use these files.

Q2: I'd also like to record some AVIs with four channels - red, green,
blue (or whatever) and alpha/opacity. Can Avifile do this? Can AVI do
this? In this case I'm not concerned about portability to Windows -
provided Avifile can read the files it writes, I'll be happy.

Q3: Avifile uses some DLLs with names like "msvidc32.dll", which are
available for download from the Avifile home page. What are the
licence terms for these DLLs? I don't have a Windows machine here, so
if they're Microsoft products, I'm worried that I may not be legally
able to use them.

Q4: When I record a file from my own code, it seems that some of the
frames are going missing. At first I noticed that the recorded file,
viewed with aviplay, appears very jerky; the frame rate sometimes
drops to the point where individual frames become apparent to the
viewer. I investigated this by reading the frames one by one and
printing out the values of ->GetTime() for each frame along with the
differences between them, using this code:

        double ft;
        static double last_ft = 0.0;

        [...]

        ft = aa->rstream->GetTime();
        printf("%f %f\n", ft, ft - last_ft);
        last_ft = ft;

When it gets jerky, the output looks like this:

7.066595 0.066666
7.133261 0.066666
7.199927 0.066666
7.466591 0.266664
7.933253 0.466662
8.466581 0.533328
9.133241 0.666660
9.866567 0.733326
10.733225 0.866658
11.799881 1.066656
13.266533 1.466652
14.399855 1.133322

The larger intervals correspond to the "jerky" regions of the file.
When recording, I specified 15 fps, so I'd expect the difference
between the successive GetTime() values to be 0.066666 every time, but
in practice it can increase well beyond this value (this seems to
happen when most of the image is changing from one frame to the next).

I suspect that the compressor is discarding frames in order to keep
the bit rate of the encoded stream roughly constant - is this right? 
If so, how can I disable this behaviour? A constant bit rate is not
important to me since this material isn't being streamed across the
net, but this frame dropping is a problem, mainly for the effect it
has on the recorded material. I'm happy for the compressor to omit
details from the recorded frames, but I'd rather it didn't omit entire
frames.

Q5: How do I set the attributes used by the compressor? I've been
experimenting with the following code:

        ci = &aa->wstream->GetCodecInfo();

        avm::CodecSetAttr(*ci, "BitRate", 10000);

        for(i=0; i<ci->encoder_info.size(); i++) {
                ai = &ci->encoder_info[i];

                printf("%d: %s: ", i, ai->GetName());

                if(ai->GetKind() == AttributeInfo::Integer) {
                        int v;

                        avm::CodecGetAttr(*ci, ai->GetName(), &v);
                        printf("int (%d) [%d-%d, default %d]\n",
                               v, ai->i_min, ai->i_max, ai->i_default);
                }
        }

which produces output like this:

0: BitRate: int (10000) [0-10000, default 5000]
1: Crispness: int (0) [0-100, default 100]
2: KeyFrames: int (0) [0-30, default 3]

...but I think I'm barking up the wrong tree, since the values I set
seem to have no effect on the resulting AVI file. Is this the right
way to adjust the codec parameters?

-- 
Mike

_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile

Reply via email to