Quantcast Manual File Prediction: Mini How-to Guide - Page 2 - digitalFAQ.com Forums [Archives]
  #21  
01-31-2003, 02:41 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
I just tweaked it a little more!

Now you can specify in the function calling the title of the movie, the number of CDs you are targeting and the correction factor.
Code:
Prediction("Matrix", 2, .99)
or
Prediction(cds=3)  
or just
Prediction()
The default values are CDs=1 and Factor=0.98
Here is the function:
Code:
#---------------------#
# Prediction Function #
#---------------------#
function Prediction (clip c, string "movie", int "cds", float "factor")
{
movie = default(movie,"No_Title_Defined") 
factor = default(factor,.98) 
cds = default(cds,1) 

MovieLength  = framecount(c)/framerate(c)
FramesTotal  = framecount(c)
FramesSample = framecount(Sampler(c,length=24))
CD_Size = 814080*cds  #1CD=795MB -> (video+audio)

d=BlankClip(c,1).
\Subtitle("Movie Title : " + movie, width(c)/2,40, text_color=$FFFFFF, size=22, align=5).

\Subtitle("Total Frames : " + String(FramesTotal),80,80).
\Subtitle("Sample Frames : " + String(FramesSample),80,100).
\Subtitle("Time (sec) : " + String(round(Movielength)),280,80).
\Subtitle("Time (min) : " + String(round(Movielength/60)),280,100).

\Subtitle("Desired Sample Size (kb)  for  " + String(cds) + " CD(s):", 80,145, text_color=$FFFFFF).
\Subtitle("- audio at 096 bps : " + String((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,168).
\Subtitle("- audio at 112 bps : " + String((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,191).
\Subtitle("- audio at 128 bps : " + String((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,214).
\Subtitle("- audio at 160 bps : " + String((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,237).
\Subtitle("- audio at 192 bps : " + String((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,260).
\Subtitle("- audio at 224 bps : " + String((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor),98,283).

\Subtitle("Average Bitrate (kbps) : " + String( ((((CD_Size-((128/8)*Movielength)))/Movielength)*8)*1),80,330).

\Subtitle("Predicted Audio File Sizes " + " (mb)", 140,380, text_color=$FFFFFF).
\Subtitle("096 bps = " + String((((096*1024)/8)*Movielength)/1048576),80,400).
\Subtitle("112 bps = " + String((((112*1024)/8)*Movielength)/1048576),80,420).
\Subtitle("128 bps = " + String((((128*1024)/8)*Movielength)/1048576),80,440).
\Subtitle("160 bps = " + String((((160*1024)/8)*Movielength)/1048576),270,400).
\Subtitle("192 bps = " + String((((192*1024)/8)*Movielength)/1048576),270,420).
\Subtitle("224 bps = " + String((((224*1024)/8)*Movielength)/1048576),270,440)

return d+c+d
}
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
01-31-2003, 02:43 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by tonyk
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.
If you put the prediction() after all filters, it will be resolution dependent. It could display correctly for some resolutions but not for others.
If you put it right after the Mpeg2Source(), then it will be resized with the frame and should display correctly with any resolution. Try this way with the last script. It's working perfectly for me.

edit: oops! Sorry kwag... I didn't hit the refresh and didn't see you post.
Reply With Quote
  #23  
01-31-2003, 02:55 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Stupid me again
IT GOES AFTER THE MPEG2SOURCE LINE
Quoting my original post: So put the Prediction() statement AFTER the line where you open the .d2v" That's the way it gets properly resized.
I'm taking a break to clear my mind

-kwag
Reply With Quote
  #24  
01-31-2003, 02:58 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Wonderful modifications muaddib
Works like a charm

-kwag
Reply With Quote
  #25  
01-31-2003, 03:53 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Work, but I can't see the title anywhere
I'm checking the screen coordinates now
Reply With Quote
  #26  
01-31-2003, 03:57 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Stupid me again
IT GOES AFTER THE MPEG2SOURCE LINE
Quoting my original post: So put the Prediction() statement AFTER the line where you open the .d2v" That's the way it gets properly resized.
I'm taking a break to clear my mind
We need two of this poster!
I think that we both need a break... because we are both wrong!
I was testing it with a 4:3 source, and it really works like a charm in this kind of source, but if we use a 16:9 source and use gripfit, it will cut the black borders and cut the displayed information too, than add the borders back again. So , at the end, I think we will have to use it after the filters.
I have to go to work now, but I'm thinking in a solution...

cya
Reply With Quote
  #27  
01-31-2003, 07:44 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Here it is... (I hope it works correctly now )

The way you call it still the same.
Use it at the end of your script, just before sampler().

Code:
#---------------------#
# Prediction Function #
#---------------------#
function Prediction (clip c, string "movie", int "cds", float "factor")
{
movie = default(movie,"No_Title_Defined") 
factor = default(factor,.98) 
cds = default(cds,1) 

MovieLength  = framecount(c)/framerate(c)
FramesTotal  = framecount(c)
FramesSample = framecount(Sampler(c,length=24))
CD_Size = 814080*cds  #1CD=795MB -> (video+audio)

d=BlankClip(c,1,544,480).
\Subtitle("Movie Title : " + movie, 272,40, text_color=$FFFFFF, size=22, align=5).

\Subtitle("Total Frames : " + String(FramesTotal), 80,81).
\Subtitle("Sample Frames : " + String(FramesSample), 80,101).
\Subtitle("Time (sec) : " + String(round(Movielength)), 290,81).
\Subtitle("Time (min) : " + String(round(Movielength/60)), 290,101).

\Subtitle("Desired Sample Size (kb)  for  " + String(cds) + " CD(s):", 80,145, text_color=$FFFFFF).
\Subtitle("- audio at 096 bps : " + String((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,168).
\Subtitle("- audio at 112 bps : " + String((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,191).
\Subtitle("- audio at 128 bps : " + String((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,214).
\Subtitle("- audio at 160 bps : " + String((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,237).
\Subtitle("- audio at 192 bps : " + String((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,260).
\Subtitle("- audio at 224 bps : " + String((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor),80,283).

\Subtitle("Average Bitrate (kbps) : "+ String(((((CD_Size-((128/8)*Movielength)))/Movielength)*8)*1), 80,328).

\Subtitle("Predicted Audio File Sizes (mb):", 80,373, text_color=$FFFFFF).
\Subtitle("096 bps = " + String((((096*1024)/8)*Movielength)/1048576),80,395).
\Subtitle("112 bps = " + String((((112*1024)/8)*Movielength)/1048576),80,416).
\Subtitle("128 bps = " + String((((128*1024)/8)*Movielength)/1048576),80,437).
\Subtitle("160 bps = " + String((((160*1024)/8)*Movielength)/1048576),270,395).
\Subtitle("192 bps = " + String((((192*1024)/8)*Movielength)/1048576),270,416).
\Subtitle("224 bps = " + String((((224*1024)/8)*Movielength)/1048576),270,437).
\BilinearResize(width(c),height(c))

return d+c
}
Reply With Quote
  #28  
01-31-2003, 07:59 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Muaddib,



Edit: It would be great if we could get the file name part from the mpeg2source line Then the title could be automatically assigned to the variable
Can't wait until AviSynth gets ported to Python code. Then I'm going to have MUCH more fun


-kwag
Reply With Quote
  #29  
01-31-2003, 08:41 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Here's a slight but very usefull mod.

Change your Prediction("Matrix", 2, .99) line to Prediction("Matrix", 2, .99).Sampler(length=24)

Now you only have to comment out this line after you read you values and encode away

-kwag
Reply With Quote
  #30  
01-31-2003, 11:59 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Change your Prediction("Matrix", 2, .99) line to Prediction("Matrix", 2, .99).Sampler(length=24)

Now you only have to comment out this line after you read you values and encode away
Much easier this way!
Reply With Quote
  #31  
02-01-2003, 05:44 PM
Gaudi Gaudi is offline
Free Member
 
Join Date: Dec 2002
Location: Buenos Aires, Argentina
Posts: 131
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Gaudi
Would it be possible to include as another frame the calculations for the new CQ?

SO, no need for a calculator or an Excel spreadsheet. Just edit the .avs, and include in the Prediction filter the obtained file size and the used CQ value.

That would be very nice.


Gaudi
Reply With Quote
  #32  
02-01-2003, 06:52 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
That can't be done Gaudi. The CQ must be found by running a full sampler on the movie.

-kwag
Reply With Quote
  #33  
02-01-2003, 07:00 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Gaudi
Would it be possible to include as another frame the calculations for the new CQ?
Hi Gaudi!

This would be great, but unfortunately while the script is processing we don't have the sample done yet, so can’t know what size it will be.

edit: Wow... I'm 8 min late! That's what happens when you answer the forum while working...
Reply With Quote
  #34  
02-01-2003, 07:52 PM
Graal_CPM Graal_CPM is offline
Free Member
 
Join Date: Jun 2002
Location: Paris, France
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Mon Dieu! I have just walked away from my computer for a few days and when I come back you have all gone crazy with avisynth scripting!!

I have just used my old trick to keep up the pace = doing a search on "kwag" name to get an idea of the last plugins and scripts to use

As I see it Kwag, you keep on posting your scripts over and over again. You should be praised for that, however here is an idea for you to spare your (golden) fingers.

Before indulging in video encoding, I was playing with lame MP3 encoder and used to hang around a site called r3mix. It was all about finding the best settings to gest the best encoded sound quality (remind you of something? ). In between many changes and tweaking, the guy "in charge" used to post his last command line parameters somewhere on the site, so that anybody could use it for encodes. Each time a better tuning was found, after days of testing and postings (sic), he updated this "recommended settings".

Well. I know that we can adjust our scripts according to source quality (ranking from excellent to crappy, even for $$$ DVDs), but a sticky post with a generic script still could do a lot good for the growing number of newcommers.

Mmmm... Maybe simply updating black prince wonderfull "how-to" would do the trick too... Just an idea.


Cheers.
Reply With Quote
  #35  
02-01-2003, 08:54 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Graal_CPM,

Yes, I know I have to put a sticky somewhere, but haven't got around to it yet
I'll see what I can do, because it's easier to reply with a link, than write and write ( or copy+paste ) over and over again

-kwag
Reply With Quote
  #36  
02-02-2003, 05:51 AM
emilius256 emilius256 is offline
Free Member
 
Join Date: May 2002
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Probably what gaudi means is, after sampler encoding edit the avs script and put the sample mpeg size.
I don't know a lot about avs scrip but i guess it could be possible this way.

bye
Reply With Quote
  #37  
02-02-2003, 12:43 PM
Gaudi Gaudi is offline
Free Member
 
Join Date: Dec 2002
Location: Buenos Aires, Argentina
Posts: 131
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Gaudi
Quote:
Originally Posted by emilius256
Probably what gaudi means is, after sampler encoding edit the avs script and put the sample mpeg size.
I don't know a lot about avs scrip but i guess it could be possible this way.

bye

Well, that was exactly what I meant. Using the avs script as a calculator. I wouldn´t mind editing the script if that makes the use of a calculator innecessary.


Thanks
Reply With Quote
  #38  
02-02-2003, 05:28 PM
emilius256 emilius256 is offline
Free Member
 
Join Date: May 2002
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
I don't know if this could be useful, but i changed the prediction script to choose the size of cd ( i often use CD-RW of 74 Min. ) like follow
Quote:
#---------------------#
# Prediction Function #
#---------------------#
function Prediction (clip c, string "movie", int "cds", float "factor", int "cdtime")
{
movie = default(movie,"No_Title_Defined")
factor = default(factor,.98)
cds = default(cds,1)
cdtime = default(cdtime,80)

MovieLength = framecount(c)/framerate(c)
FramesTotal = framecount(c)
FramesSample = framecount(Sampler(c,length=24))
CD_Size = (((cdtime*10)-5)*1024)*cds

d=BlankClip(c,1,544,480).
\Subtitle("Movie Title : " + movie, 272,40, text_color=$FFFFFF, size=22, align=5).
80 min. is default but you can specify another size
prediction("Matrix",2,.99,74)
or
prediction(cdtime=74)
bye
Reply With Quote
  #39  
02-02-2003, 07:05 PM
rendalunit rendalunit is offline
Free Member
 
Join Date: Apr 2002
Location: san jose, Ca
Posts: 1,148
Thanks: 0
Thanked 0 Times in 0 Posts
I changed the desired sample size to mb and truncated to four digits. Also rounded off the audio mb's.

Code:
#---------------------#
# Prediction Function #
#---------------------#

function Prediction (clip c, string "movie", int "cds", float "factor")

{
movie = default(movie,"No_Title_Defined")
factor = default(factor,0.98)
cds = default(cds,1)

MovieLength  = framecount(c)/framerate(c)
FramesTotal  = framecount(c)
FramesSample = framecount(Sampler(c,length=24))
CD_Size = 814080*cds  #1CD=795MB -> (video+audio)

d=BlankClip(c,1,544,480).
\Subtitle("Movie Title : " + movie, 272,40, text_color=$FFFFFF, size=22, align=5).

\Subtitle("Total Frames : " + String(FramesTotal), 80,81).
\Subtitle("Sample Frames : " + String(FramesSample), 80,101).
\Subtitle("Time (sec) : " + String(round(Movielength)), 290,81).
\Subtitle("Time (min) : " + String(round(Movielength/60)), 290,101).

\Subtitle("Desired Sample Size (mb)  for  " + String(cds) + " CD(s):", 80,145, text_color=$FFFFFF).
\Subtitle("- audio at  96 bps : " + LeftStr(String((((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,168).
\Subtitle("- audio at 112 bps : " + LeftStr(String((((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,191).
\Subtitle("- audio at 128 bps : " + LeftStr(String((((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,214).
\Subtitle("- audio at 160 bps : " + LeftStr(String((((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,237).
\Subtitle("- audio at 192 bps : " + LeftStr(String((((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,260).
\Subtitle("- audio at 224 bps : " + LeftStr(String((((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,283).

\Subtitle("Average Bitrate (kbps) : "+ String(Round(((((CD_Size-((128/8)*Movielength)))/Movielength)*8)*1)), 80,328).

\Subtitle("Predicted Audio File Sizes (mb):", 80,373, text_color=$FFFFFF).
\Subtitle(" 96 bps = " + String(Round(((( 96*1024)/8)*Movielength)/1048576)),80,395).
\Subtitle("112 bps = " + String(Round((((112*1024)/8)*Movielength)/1048576)),80,416).
\Subtitle("128 bps = " + String(Round((((128*1024)/8)*Movielength)/1048576)),80,437).
\Subtitle("160 bps = " + String(Round((((160*1024)/8)*Movielength)/1048576)),270,395).
\Subtitle("192 bps = " + String(Round((((192*1024)/8)*Movielength)/1048576)),270,416).
\Subtitle("224 bps = " + String(Round((((224*1024)/8)*Movielength)/1048576)),270,437).

\bilinearResize(width(c), height(c))
return d+c+d
}
Reply With Quote
  #40  
02-02-2003, 07:10 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
This is getting better every day
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
KVCD Predictor or Manual Prediction vhelp Avisynth Scripting 12 08-08-2004 02:59 AM
Mencoder: New mini-guide for KSVCD maurus Video Encoding and Conversion 0 05-31-2004 04:28 AM
Where to get DVD to mini-kDVD guide ? Critter Video Encoding and Conversion 0 11-03-2003 01:50 AM
Mini guide to make GOOD mp3s! azel Audio Conversion 0 10-03-2003 03:54 PM
File prediction using TMPGEnc method from KVCD guide wretched Avisynth Scripting 8 05-25-2003 05:35 PM

Thread Tools



 
All times are GMT -5. The time now is 10:32 PM  —  vBulletin © Jelsoft Enterprises Ltd