Rencode AVI to match the size of the given output file.

I have an AVI file that I want to recode for installation on a 650MB CD. How to encode so that the file size does not exceed the given size? Which program can I use?

+1


source to share


4 answers


AutoGK can do this very efficiently. Primarily designed to backup DVD **** cough ****, but it will also accept AVI as source. It is more of an open source suite of software with a coordinating GUI, so don't worry when the installer installs multiple items.



0


source


I assume you want to do this programmatically:

For Windows:

You can use directshow to transcode your video by building a filter graph.

Get (if you don't already have) the Windows Platform SDK. Then look here to check out some directshow examples that plot filters for transcoding.

To build you need base classes. You can build them here:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\BaseClasses

      

Then check the examples here:

C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow

      

You can also manually create filter plots to hang on to how they are used and see how these things make sense (like listing the coders you'll learn about in the examples):



C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\graphedt.exe

      

Once you've gotten this far and understood how directshow works, you can use some math to figure out how to recode your video to the size you want. To do this, you can see how many frames / sec your input video is and how large each frame is.

Different encoders work in different ways:

Suppose you are converting an avi file to a lower or lower quality avi file. Look at the input frame sizes and fps to figure out the entire file size, then use some algebra to figure out how to reduce the frame size or reduce the frames per second (or a combination of both) to achieve the size you want (what your input variable might be).

As with other coders, you can see how they work. Lossy codes like mp4 perform estimates to find out which video has changed from frame to frame, and this information is stored in the file to recover frames. You will need to read about how they work or learn how to use a particular encoder for more details.

For Linux (as well as windows):

You can use ffmpeg , which is a multifunctional device for transcoding and other things for videos. You can even find the prebuilt exe from the command line application, although the main page doesn't host it (source only). This app uses open source video libraries to do a lot of video transcoding as well as much more. If you can find a good reliable exe file, you should probably check it out if you want something that is easy to use for your application. Check out your home page here.

Hope this helps you.

+2


source


To fit a specific size, you must use the appropriate baud rate.

For fixed bit rate video, to get the target bit rate, you must take the target size, bit, and source length in seconds.

target bit-rate = size / seconds

      

For example:

seconds = (90mins * 60) = 5400
size = ((650MB * 1024) * 8) = 5324800
target bit-rate = ~986 kilobytes per second

      

With variable data rates, things are pretty complicated. Not really sure if there is a way to exactly make the output file the specified size. The easiest way is to calculate the maximum baud rate using the above method,

+2


source


Calculate the number of seconds during which the AVI. Then take the size of the file and divide it by the length. Convert to kilobits per second and use that as the median bitrate. (Use Google for easy math and transformation.)

You can weigh video and audio bitrates as you see fit. Usually 96 kbps is good enough with AAC, but you may want more or less. Experiment.

0


source







All Articles