Manual File Prediction: Mini How-to Guide
Here's the manual way to do file size prediction. I assume you have your material already prepared and you have created your basic .avs script using FitCD. I also assume you have extracted your audio in AC3 or WAV format.
Step 1: Determine the Audio file size. Say you want to put your movie on one CD. First thing you do is find out the size of your audio file. That's very easy with the help of HeadAC3he. Just run HeadAC3he and select your demuxed AC3 or WAV audio file. Select .mp2 as output and the audio bit rate you want to use. I usually select either 112Kbps for 120+ minute movies or 128Kbps for movies shorter than that. You'll see the audio size is automatically displayed in HeadAC3he. Make a note of the size. Step 2: Determine the Video file size. Suppose the audio in step 1 is 87MB, and our CD-R is 700MB 80 minutes. Remember that VCDs are written in what's called "Mode-2", so a 700MB data CD-R will actually fit ~800MB in VCD format. So we'll use an 80 minute CD-R for this example. Now do this: 800 - 87 = 713. The ~800 is your VCD capacity. So you have ~713MB left for your video stream, and this will be the predicted file size for the video. Now apply the formula like this: Predicted MPEG size = (( Total frames/MovieTimeInMinutes) / 24 ) * MPEG sample file size Say your movie has 198,673 frames and is 138 minutes long. You would do this: 198673 / 138 / 24 = 59.98 and store the value 59.98 in your calculator's memory for a moment. Now do this: 713 / MemoryRecall(which is 59.98 ) = 11.88MB and that's what your sample size has to be. Now you encode with SansGrip "Sampler()" line at the end of your .avs. Here's what a basic .avs script looks like, with the file prediction line added at the end: Code:
LoadPlugin("C:\encoding\MPEG2DEC.dll") New_CQ_Value = WantedSize(11.88 in this case) / Encoded_Sample_Size * Current_CQ_Value Say your sample comes out to 10.0MB, and you are encoding with a CQ value of 25. The new CQ value for the next run is: 11.88 / 10 * 25 = 29.7 So you change the CQ value in TMPEG to 29.7 and encode another sample. It usually takes 3 to 4 samples to hit your target this way. When you get close to the wanted file size, say < 1%, just remove the line "Sampler()" from your .avs script and when you hit encode again, your complete movie will start to encode. Hope this helps -kwag |
:D :D :D :wink:
thanks! |
Manual size prediction helper script
:idea: If you past the following at the end of your movie avs script and open it in virtualdub or your favorite media player, this will show you movie total frames, movie lenght, sample total frames, and will calculate various sound file size (same accuracy as Headac3he).
Then you can write down these numbers, comment out "Prediction()" line putting a # in front of it, and go on with the prediction process described in black prince's or kwag's guides. Code:
Prediction() |
Re: Manual size prediction helper script
Quote:
Quote:
|
Excelent guys :D
Here's further refinement, because the way the script is set, at 352x240 everything gets cut off. So put the Prediction() statement AFTER the line where you open the .d2v, and the actual function at the end of the script. Like this: Code:
LoadPlugin("C:\encoding\mpeg2dec.dll") -kwag |
Need a litle help here....exactly what is the going to do for me? I'm not sure I follow what this script is doing. Thanks in advance
Bud |
Hi Bud,
The script above will display the audio file sizes with different audio bit rates, and give the sample file size you need for each different audio bit rates. So you don't have to manually calculate the stuff :D. It's pretty cool 8) -kwag |
Kwag
Thanks,,,i'll give it a try...been having great results by using the manual method on both the 352x240 and KVCDx3 templates for one CD. Bud |
Quote:
I added a line for movie title since I like to capture the image and keep it handy with the movie which I am encoding. I also cleaned up the code to avoid confusion for those cutting and pasting. Thanks for the code help about the resizaing ( I actually thought of that but forgot to implement. :roll: ), and thanks to Graal_CPM for coming up the initial idea. I was constantly opening Excel or calculator to calculate the sample sizes. Racer99 |
I can't wait for this to happen: http://www.avisynth.org/index.php?page=WhyPython
As Python is my favorite language of all times ( Been doing Python now for ~3 years ), the possibilities will be ENDLESS! Imagine this: On one machine I can have a "Server" script running, and from remote machines, you can be encoding by serving via TCP/IP to a client where TMPEG is running :mrgreen: :mrgreen: Frameserving through the internet :lol: The future looks bright 8) -kwag |
Hi all!
Here is my 2 cents for this great script: Well I think that if we leave all these subtitles in all sample’s frames, it can disturb the prediction accuracy, so I created two frames, one at the beginning and one at the end of the sample, and I show all the information only in this two frames. Other change is that I added the title of the movie as a parameter of the function. I did this because I have a file with many functions, and I just call this file when I need some of the functions. Here is how I call it: Code:
Import("D:\DVD Rip Tools\AviSynth2\filters\functions.avs") I just have one doubt... in the end of the old (and the new) formula, we are dividing by .98! If we want to give a little breath of 2% shouldn't we multiply by .98? Oh, I also make some cosmetic changes like font formatting and positioning. I have to move the top and bottom subtitles because they got cut by the LetterBox filter. Here is the function: Code:
Function Prediction (clip c, string "movie") { |
What can I say muaddib :D
Kudos :mrgreen: -kwag |
I couldn't get this to work.
Here's my script: Code:
LoadPlugin("D:\avfilters\legalclip.dll") Code:
Import("F:\sample avisynth scripts\function.avs") Code:
Function Prediction (clip c, string "movie") { Script error: Subtitle does not have a named argument "align" (F:\sample avisynth scripts\function.avs, line 29) (H:\lotr2\lotr2~1.avs, line 16) Any ideas? |
Quote:
Donload avisynch 2.07. edit: BTW, you have to specify the video title or it will not work. How can I set a default value for an argument in an avisynch function? |
Quote:
Quote:
|
Quote:
-kwag |
OOPS! I thought i had 2.07 this whole time!!! :oops: Thanks!
|
Why wouldn't the prediction() line be after the filters? When i put it right after the mpeg2source everything is still cut off.
|
Smoochie3 -
I think you're correct - if the Prediction("movie") line is placed right before the Sampler(length=24) line (at the end of the script after all filters), everything displays correctly, otherwise it's cut off. Excellent script! Thanks, --TonyK. |
Quote:
-kwag |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.