Quantcast Manual File Prediction: Mini How-to Guide - Page 3 - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #41  
02-04-2003, 08:53 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 modified this script again to show a recommended cq to use using the simple formula new cq= (wanted sample size*cq used)/sample size). After you've encoded a sample put the size (mb) and cq at the top of the script and open it in WMP. I haven't decided whether this is totally useless yet because it's probably easier to use a calculator

Code:
Prediction("Band of Brothers", 1, 0.99, SampleSize, CQ, MinAudioBitrate=320).  Sampler(length=24)  


#------------------------------#
# Prediction Function          #
#------------------------------#

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

{
movie = default(movie,"No_Title_Defined")
factor = default(factor,0.98)
cds = default(cds,0)
SampleSize = default(SampleSize,0)
CQ = default(CQ,0)
MinAudioBitrate = default(MinAudioBitrate,128)      # lowest audio bitrate wanted

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


MinAudio = (((((CD_Size-((MinAudioBitrate/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000
EncodedSample = (SampleSize==0)? false: true     #--------------------------------------------------------------------
SampleSize = (SampleSize==0)? 1: SampleSize    # if sample size =0 mb then no previous sample.
CQ = (CQ<=0)? 1 :CQ                                          # set cq between 1-100                                                          
CQ = (CQ>100)?100 : CQ                                     #---------------------------------------------------------------------
SampleSizeMessage=(EncodedSample==false)?"no sample encoded yet **********": "Sample Size (mb) : "
SampleCQMessage=(EncodedSample==false)?"no sample encoded yet **********":"Sample CQ : "
TryCQValueMessage=(EncodedSample==false)?"no sample encoded yet ******":"Try CQ value of : "

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,60).
\Subtitle("Sample Frames : " + String(FramesSample), 80,80).
\Subtitle("Time (sec) : " + String(round(Movielength)), 80,100).
\Subtitle("Time (min) : " + String(round(Movielength/60)), 80,120).

\Subtitle(SampleSizeMessage+LeftStr(String(SampleSize),5), 270,60,text_color=$FF0000).
\Subtitle(SampleCQMessage + LeftStr(String(CQ),4),270,80,text_color=$FF0000).
\Subtitle("Min. Audio Bitrate : "+ String(MinAudioBitrate)+" kbps",270,100,text_color=$FF0000).
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(MinAudio),5),270,120,text_color=$FF0000).
\Subtitle(TryCQValueMessage + LeftStr(String((MinAudio*CQ)/SampleSize),4),270,140,text_color=$FF0000).

\Subtitle("Desired Sample Size (mb)  for  " + String(cds) + " CD(s):", 80,165, text_color=$FFFFFF).
\Subtitle("- audio at  96 kbps : " + LeftStr(String((((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,185).
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,205).
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,225). 
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,245).
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,265).
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,285).

\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 kbps = " + String(Round(((( 96*1024)/8)*Movielength)/1048576)),80,395).
\Subtitle("112 kbps = " + String(Round((((112*1024)/8)*Movielength)/1048576)),80,416).
\Subtitle("128 kbps = " + String(Round((((128*1024)/8)*Movielength)/1048576)),80,437).
\Subtitle("160 kbps = " + String(Round((((160*1024)/8)*Movielength)/1048576)),270,395).
\Subtitle("192 kbps = " + String(Round((((192*1024)/8)*Movielength)/1048576)),270,416).
\Subtitle("224 kbps = " + String(Round((((224*1024)/8)*Movielength)/1048576)),270,437).

\BilinearResize(width(c), height(c))
return d+c+d
}

edit: I cleaned up the code a little bit
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
  #42  
02-05-2003, 01:42 AM
ozjeff99 ozjeff99 is offline
Free Member
 
Join Date: May 2002
Location: Sydney, Australia
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Kwag

Just wondered if the formula for prediction:

Predicted MPEG size = (( Total frames/MovieTimeInMinutes) / 24 ) * MPEG sample file size

is the same for NTSC and PAL.

Cheers
Jeff
Reply With Quote
  #43  
02-05-2003, 02:07 AM
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
Quote:
Originally Posted by ozjeff99
Hi Kwag

Just wondered if the formula for prediction:

Predicted MPEG size = (( Total frames/MovieTimeInMinutes) / 24 ) * MPEG sample file size

is the same for NTSC and PAL.

Cheers
Jeff
Yes it is Jeff

-kwag
Reply With Quote
  #44  
02-06-2003, 07:50 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
Quote:
Originally Posted by earlier i
I haven't decided whether this is totally useless yet because it's probably easier to use a calculator
Well now I've decided this is much easier than using a calculator Instead of opening the .avs in WMP, I load the .avs into Tmpg and hit "preview"- then I can read the numbers. Thanks Graal_CPM, Mauddib, Racer99, Kwag-- you guys rock!!!!
Reply With Quote
  #45  
02-06-2003, 08:11 PM
vhelp vhelp is offline
Free Member
 
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
evening guys.. rendalunit,
can I ask a really shtupid question..?? ..??

can this now be incorporated in FitCD's calculations ?? ..or is this not
necessary ??

Told ya it would be shtupid, he he..
Have a good evening all.
-vhelp
Reply With Quote
  #46  
02-06-2003, 08:20 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
Quote:
Originally Posted by vhelp
evening guys.. rendalunit,
can I ask a really shtupid question..?? ..??

can this now be incorporated in FitCD's calculations ?? ..or is this not
necessary ??

Told ya it would be shtupid, he he..
Have a good evening all.
-vhelp
hi vhelp, I think I'm shtoopid because I'm not sure what you mean
ren
Reply With Quote
  #47  
02-06-2003, 08:39 PM
vhelp vhelp is offline
Free Member
 
Join Date: Jan 2003
Posts: 1,009
Thanks: 0
Thanked 0 Times in 0 Posts
here spot, i mean rendalunit, he he..

I was having a looksees at FitCD's code and doing a few what-if's while
I was reading some of these posts here (yestday I think) anyways.. then
I came accross this post, and thought I'd just ask a really
shtupid question..?? ..?? w/out actually thinking it out through..
hence the shtupid'ness of the question
(soon or later, I have ta ask a shtupid question)

after looking around where's at the source code, (I can't remember) I
stopped and gave up on it for something more appealing (my project)
but I remembered roming around in it, and this thread jarred my memory.

Thats all.
-vhelp
Reply With Quote
  #48  
02-06-2003, 10:57 PM
jorel jorel is offline
Invalid Email / Banned / Spammer
 
Join Date: Aug 2002
Location: Brasil - MG - third stone from the sun
Posts: 5,570
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rendalunit
Quote:
Originally Posted by earlier i
I haven't decided whether this is totally useless yet because it's probably easier to use a calculator
Well now I've decided this is much easier than using a calculator Instead of opening the .avs in WMP, I load the .avs into Tmpg and hit "preview"- then I can read the numbers. Thanks Graal_CPM, Mauddib, Racer99, Kwag-- you guys rock!!!!
....very good!
"...is much easier than using a calculator ...
....avs into Tmpg and hit "preview"- ..."

"Thanks Graal_CPM, Mauddib, Racer99, Kwag-- you guys rock!!!!"
you too rendalunit!
Reply With Quote
  #49  
02-21-2003, 04:29 AM
TCC TCC is offline
Free Member
 
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Sorry for the long post I copied and pasted the code by rendalunit and ran it in WMP and got an error stating:

This refers to the line I highted in red. When I comment it out the script works fine. Am I missing something?? Below the quote is my script.

Also, where do you put in the CQ and sample size because it states "After you've encoded a sample put the size (mb) and cq at the top of the script and open it in WMP."

Thank you for your time and patience


Quote:
Originally Posted by rendalunit
I modified this script again to show a recommended cq to use using the simple formula new cq= (wanted sample size*cq used)/sample size). After you've encoded a sample put the size (mb) and cq at the top of the script and open it in WMP. I haven't decided whether this is totally useless yet because it's probably easier to use a calculator

Prediction("Band of Brothers", 1, 0.99, SampleSize, CQ, MinAudioBitrate=320). Sampler(length=24)


#------------------------------#
# Prediction Function #
#------------------------------#

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

{
movie = default(movie,"No_Title_Defined")
factor = default(factor,0.98 )
cds = default(cds,0)
SampleSize = default(SampleSize,0)
CQ = default(CQ,0)
MinAudioBitrate = default(MinAudioBitrate,12 # lowest audio bitrate wanted

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


MinAudio = (((((CD_Size-((MinAudioBitrate/*Movielength))*FramesSample)/FramesTotal)*factor))/1000
EncodedSample = (SampleSize==0)? false: true #--------------------------------------------------------------------
SampleSize = (SampleSize==0)? 1: SampleSize # if sample size =0 mb then no previous sample.
CQ = (CQ<=0)? 1 :CQ # set cq between 1-100
CQ = (CQ>100)?100 : CQ #---------------------------------------------------------------------
SampleSizeMessage=(EncodedSample==false)?"no sample encoded yet **********": "Sample Size (mb) : "
SampleCQMessage=(EncodedSample==false)?"no sample encoded yet **********":"Sample CQ : "
TryCQValueMessage=(EncodedSample==false)?"no sample encoded yet ******":"Try CQ value of : "

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,60).
\Subtitle("Sample Frames : " + String(FramesSample), 80,80).
\Subtitle("Time (sec) : " + String(round(Movielength)), 80,100).
\Subtitle("Time (min) : " + String(round(Movielength/60)), 80,120).

\Subtitle(SampleSizeMessage+LeftStr(String(SampleS ize),5), 270,60,text_color=$FF0000).
\Subtitle(SampleCQMessage + LeftStr(String(CQ),4),270,80,text_color=$FF0000).
\Subtitle("Min. Audio Bitrate : "+ String(MinAudioBitrate)+" kbps",270,100,text_color=$FF0000).
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(MinAudio),5),270,120,text_color=$FF 0000).
\Subtitle(TryCQValueMessage + LeftStr(String((MinAudio*CQ)/SampleSize),4),270,140,text_color=$FF0000).

\Subtitle("Desired Sample Size (mb) for " + String(cds) + " CD(s):", 80,165, text_color=$FFFFFF).
\Subtitle("- audio at 96 kbps : " + LeftStr(String((((((CD_Size-((096/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,185).
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CD_Size-((112/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,205).
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CD_Size-((128/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,225).
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CD_Size-((160/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,245).
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CD_Size-((192/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,265).
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CD_Size-((224/8 )*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,285).

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

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

\BilinearResize(width(c), height(c))
return d+c+d
}
Code:
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\MPEG2DEC.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\FluxSmooth.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\GripFit_preview.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\Blockbuster.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\LegalClip.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\Sampler.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\DustV5.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\TemporalCleanerOld.dll") 

Mpeg2Source("D:\kvcd.d2v") 
Prediction() 

LegalClip() 
GripCrop( width=528, height=480, overscan=1 ) 
GripSize() 
SpaceDust() 
TemporalCleaner() 
Blockbuster(method="noise", variance=.7, seed=1) 
GripBorders() 
LegalClip()
 

Prediction("DVD Rips", 1, 0.99, SampleSize, CQ, MinAudioBitrate=320).  Sampler(length=24)  


#------------------------------# 
# Prediction Function          # 
#------------------------------# 

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

{ 
movie = default(movie,"No_Title_Defined") 
factor = default(factor,0.98) 
cds = default(cds,0) 
SampleSize = default(SampleSize,0) 
CQ = default(CQ,0) 
MinAudioBitrate = default(MinAudioBitrate,128)      # lowest audio bitrate wanted 

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


MinAudio = (((((CD_Size-((MinAudioBitrate/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000 
EncodedSample = (SampleSize==0)? false: true     #-------------------------------------------------------------------- 
SampleSize = (SampleSize==0)? 1: SampleSize    # if sample size =0 mb then no previous sample. 
CQ = (CQ<=0)? 1 :CQ                                          # set cq between 1-100                                                          
CQ = (CQ>100)?100 : CQ                                     #--------------------------------------------------------------------- 
SampleSizeMessage=(EncodedSample==false)?"no sample encoded yet **********": "Sample Size (mb) : " 
SampleCQMessage=(EncodedSample==false)?"no sample encoded yet **********":"Sample CQ : " 
TryCQValueMessage=(EncodedSample==false)?"no sample encoded yet ******":"Try CQ value of : " 

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,60). 
\Subtitle("Sample Frames : " + String(FramesSample), 80,80). 
\Subtitle("Time (sec) : " + String(round(Movielength)), 80,100). 
\Subtitle("Time (min) : " + String(round(Movielength/60)), 80,120). 

\Subtitle(SampleSizeMessage+LeftStr(String(SampleSize),5), 270,60,text_color=$FF0000). 
\Subtitle(SampleCQMessage + LeftStr(String(CQ),4),270,80,text_color=$FF0000). 
\Subtitle("Min. Audio Bitrate : "+ String(MinAudioBitrate)+" kbps",270,100,text_color=$FF0000). 
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(MinAudio),5),270,120,text_color=$FF0000). 
\Subtitle(TryCQValueMessage + LeftStr(String((MinAudio*CQ)/SampleSize),4),270,140,text_color=$FF0000). 

\Subtitle("Desired Sample Size (mb)  for  " + String(cds) + " CD(s):", 80,165, text_color=$FFFFFF). 
\Subtitle("- audio at  96 kbps : " + LeftStr(String((((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,185). 
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,205). 
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,225). 
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,245). 
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,265). 
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,285). 

\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 kbps = " + String(Round(((( 96*1024)/8)*Movielength)/1048576)),80,395). 
\Subtitle("112 kbps = " + String(Round((((112*1024)/8)*Movielength)/1048576)),80,416). 
\Subtitle("128 kbps = " + String(Round((((128*1024)/8)*Movielength)/1048576)),80,437). 
\Subtitle("160 kbps = " + String(Round((((160*1024)/8)*Movielength)/1048576)),270,395). 
\Subtitle("192 kbps = " + String(Round((((192*1024)/8)*Movielength)/1048576)),270,416). 
\Subtitle("224 kbps = " + String(Round((((224*1024)/8)*Movielength)/1048576)),270,437). 

\BilinearResize(width(c), height(c)) 
return d+c+d 
}
Reply With Quote
  #50  
02-21-2003, 05:43 AM
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
SampleSize and CQ need defining with =x added to them
i put the Prediction function variables at the top of the script so it's easier to edit.
Code:
LoadPlugin("C:\encoding\MPEG2DEC2.dll")
LoadPlugin("C:\encoding\legalclip.dll")
LoadPlugin("C:\encoding\Dustv5.dll")
LoadPlugin("C:\encoding\BlockBuster.dll")
LoadPlugin("C:\encoding\FluxSmooth.dll")
LoadPlugin("C:\encoding\Sampler.dll")

SampleSize=0
CQ=0

movie="The Bourne Identity"
cds=2
cdtime=80
MinAudioBitrate=128
factor=0.98

Mpeg2Source("D:\THE_BOURNE_IDENTITY\VIDEO_TS\bourne.d2v")
LegalClip()
BilinearResize(512,344,3,0,714,480)
temporalSmoother(2,2)
AddBorders(8,68,8,68)
LegalClip()

trim(0,round(framecount/10))          #  'mini'-prediction    1/10 prediction- comment this line when cq in range
prediction(movie, cds , cdtime, factor,  SampleSize, CQ,  MinAudioBitrate).  Sampler(length=24)   


#------------------------------#
# Prediction Function #
#------------------------------#

function Prediction (clip c, string "movie", int "cds", int "cdtime", float "factor", float "SampleSize", float "CQ", int "MinAudioBitrate")

{
movie = default(movie,"No_Title_Defined")
factor = default(factor,0.98)
cds = default(cds,0)
cdtime = default(cdtime,80)
SampleSize = default(SampleSize,0)
CQ = default(CQ,0)
MinAudioBitrate = default(MinAudioBitrate,128)      # lowest audio bitrate wanted

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

MinAudio = (((((CD_Size-((MinAudioBitrate/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000
EncodedSample = (SampleSize==0)? false: true     #--------------------------------------------------------------------
SampleSize = (SampleSize==0)? 1: SampleSize    # if sample size =0 mb then no previous sample.
CQ = (CQ<=0)? 1 :CQ                                          # set cq between 1-100                                                         
CQ = (CQ>100)?100 : CQ                                     #---------------------------------------------------------------------
SampleSizeMessage=(EncodedSample==false)?"no sample encoded yet **********": "Sample Size (mb) : "
SampleCQMessage=(EncodedSample==false)?"no sample encoded yet **********":"Sample CQ : "
TryCQValueMessage=(EncodedSample==false)?"no sample encoded yet ******":"Try CQ value of : "

d=BlankClip(c,1,544,480).

\Subtitle(movie, 272,40, halo_color=$5500FF, text_color=$FFFFFF, font="Courier", size=27, align=5).

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

\Subtitle(SampleSizeMessage+LeftStr(String(SampleSize),5), 270,60,text_color=$FF0000).
\Subtitle(SampleCQMessage + LeftStr(String(CQ),4),270,80,text_color=$FF0000).
\Subtitle("Min. Audio Bitrate : "+ String(MinAudioBitrate)+" kbps",270,100,text_color=$FF0000).
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(MinAudio),5),270,120,text_color=$FF0000).
\Subtitle(TryCQValueMessage + LeftStr(String((MinAudio*CQ)/SampleSize),4),270,140,text_color=$FF0000).

\Subtitle("Desired Sample Size (mb)  for  " + String(cds) + " CD(s):", 80,165, text_color=$FFFFFF).
\Subtitle("- audio at  96 kbps : " + LeftStr(String((((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,185).
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,205).
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,225).
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,245).
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,265).
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,285).

\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 kbps = " + String(Round(((( 96*1024)/8)*Movielength)/1048576)),80,395).
\Subtitle("112 kbps = " + String(Round((((112*1024)/8)*Movielength)/1048576)),80,416).
\Subtitle("128 kbps = " + String(Round((((128*1024)/8)*Movielength)/1048576)),80,437).
\Subtitle("160 kbps = " + String(Round((((160*1024)/8)*Movielength)/1048576)),270,395).
\Subtitle("192 kbps = " + String(Round((((192*1024)/8)*Movielength)/1048576)),270,416).
\Subtitle("224 kbps = " + String(Round((((224*1024)/8)*Movielength)/1048576)),270,437).

\BilinearResize(width(c), height(c))
return d+c+d
}
edit: after you've encoded one sample, then replace the lines at the top: SampleSize=0
CQ=0

with the sample size in mb and CQ value used:
i.e. SampleSize=7.143
CQ=76.5
Reply With Quote
  #51  
02-21-2003, 07:13 AM
TCC TCC is offline
Free Member
 
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
ok I copied the above script and substituted my filters in instead but the sample size of my first run with a CQ of 60 is giving me a 1.3MB size And what usually takes about 15min to do a sample is taking like 2 mins.

Also, where do you comment out the prediction function when you're ready to encode the whole movie

Thanks

Here it is
Code:
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\MPEG2DEC.dll")
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\FluxSmooth.dll")
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\GripFit_preview.dll")
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\Blockbuster.dll")  
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\LegalClip.dll") 
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\Sampler.dll")
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\Convolution3D.dll")
LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\DustV5.dll") 
#LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\TemporalCleanerOld.dll") 
#LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\DecombLegacy.dll")
#LoadPlugin("C:\WINDOWS\Desktop\VCD Filters\NoMoSmooth.dll")

SampleSize=0 
CQ=0

movie="DVD Rips" 
cds=1 
cdtime=80 
MinAudioBitrate=128 
factor=0.98  

mpeg2source("D:\kvcd.d2v") 

LegalClip() 
GripCrop( width=528, height=480, overscan=2 ) 
GripSize()
GripBorders()
FaeryDust()
Convolution3D(preset="movieLQ") 
LegalClip()

trim(0,round(framecount/10))        #  'mini'-prediction    1/10 
Prediction- comment this line when cq in range
Prediction(movie, cds, cdtime, factor,  SampleSize, CQ,  MinAudioBitrate).  Sampler(length=24)  


#------------------------------# 
# Prediction Function          # 
#------------------------------# 

function Prediction (clip c, string "movie", int "cds", int "cdtime", float "factor", float "SampleSize", float "CQ", int "MinAudioBitrate") 

{ 
movie = default(movie,"No_Title_Defined") 
factor = default(factor,0.98) 
cds = default(cds,0) 
cdtime = default(cdtime,80) 
SampleSize = default(SampleSize,0) 
CQ = default(CQ,0) 
MinAudioBitrate = default(MinAudioBitrate,128)      # lowest audio bitrate wanted 

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

MinAudio = (((((CD_Size-((MinAudioBitrate/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000 
EncodedSample = (SampleSize==0)? false: true     #-------------------------------------------------------------------- 
SampleSize = (SampleSize==0)? 1: SampleSize    # if sample size =0 mb then no previous sample. 
CQ = (CQ<=0)? 1 :CQ                                          # set cq between 1-100                                                          
CQ = (CQ>100)?100 : CQ                                     #--------------------------------------------------------------------- 
SampleSizeMessage=(EncodedSample==false)?"no sample encoded yet **********": "Sample Size (mb) : " 
SampleCQMessage=(EncodedSample==false)?"no sample encoded yet **********":"Sample CQ : " 
TryCQValueMessage=(EncodedSample==false)?"no sample encoded yet ******":"Try CQ value of : " 

d=BlankClip(c,1,544,480). 

\Subtitle(movie, 272,40, halo_color=$5500FF, text_color=$FFFFFF, font="Courier", size=27, align=5). 

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

\Subtitle(SampleSizeMessage+LeftStr(String(SampleSize),5), 270,60,text_color=$FF0000). 
\Subtitle(SampleCQMessage + LeftStr(String(CQ),4),270,80,text_color=$FF0000). 
\Subtitle("Min. Audio Bitrate : "+ String(MinAudioBitrate)+" kbps",270,100,text_color=$FF0000). 
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(MinAudio),5),270,120,text_color=$FF0000). 
\Subtitle(TryCQValueMessage + LeftStr(String((MinAudio*CQ)/SampleSize),4),270,140,text_color=$FF0000). 

\Subtitle("Desired Sample Size (mb)  for  " + String(cds) + " CD(s):", 80,165, text_color=$FFFFFF). 
\Subtitle("- audio at  96 kbps : " + LeftStr(String((((((CD_Size-((096/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,185). 
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CD_Size-((112/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,205). 
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CD_Size-((128/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,225). 
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CD_Size-((160/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,245). 
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CD_Size-((192/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,265). 
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CD_Size-((224/8)*Movielength))*FramesSample)/FramesTotal)*factor))/1000),5),80,285). 

\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 kbps = " + String(Round(((( 96*1024)/8)*Movielength)/1048576)),80,395). 
\Subtitle("112 kbps = " + String(Round((((112*1024)/8)*Movielength)/1048576)),80,416). 
\Subtitle("128 kbps = " + String(Round((((128*1024)/8)*Movielength)/1048576)),80,437). 
\Subtitle("160 kbps = " + String(Round((((160*1024)/8)*Movielength)/1048576)),270,395). 
\Subtitle("192 kbps = " + String(Round((((192*1024)/8)*Movielength)/1048576)),270,416). 
\Subtitle("224 kbps = " + String(Round((((224*1024)/8)*Movielength)/1048576)),270,437). 

\BilinearResize(width(c), height(c)) 
return d+c+d 
}
Reply With Quote
  #52  
02-21-2003, 08:18 AM
TCC TCC is offline
Free Member
 
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
trim(0,round(framecount/10)) # 'mini'-prediction 1/10 Prediction- comment this line when cq in range
I just commented out this line and I got back my "usual" sample size. It seems like this line reduces the command Sampler(length=24). Someone correct me if I'm wrong.

Quote:
Prediction(movie, cds, cdtime, factor, SampleSize, CQ, MinAudioBitrate). Sampler(length=24)
If I comment out this line then I can encode the whole movie minus the prediction function right

Boy, do I feel like I'm back in school
Reply With Quote
  #53  
02-21-2003, 09:56 AM
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
Quote:
Originally Posted by TCC
Quote:
trim(0,round(framecount/10)) # 'mini'-prediction 1/10 Prediction- comment this line when cq in range
I just commented out this line and I got back my "usual" sample size. It seems like this line reduces the command Sampler(length=24). Someone correct me if I'm wrong.
Yes, that line is there to give you 10% of the regular sample. You would take it out to do the complete sampler.
Quote:

Quote:
Prediction(movie, cds, cdtime, factor, SampleSize, CQ, MinAudioBitrate). Sampler(length=24)
If I comment out this line then I can encode the whole movie minus the prediction function right
You got it
Quote:

Boy, do I feel like I'm back in school
It happens to me almost every day. If I leave the site for a couple of days, when I come back, I see all sort of new things and I'm lost for a couple of hours

-kwag
Reply With Quote
  #54  
02-21-2003, 12:47 PM
TCC TCC is offline
Free Member
 
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
FINALLY :yippie: It's working

Thanks rendalunit and kwag.
Now I can go to sleep while it encodes
Reply With Quote
  #55  
02-27-2003, 11:39 PM
ARnet_tenRA ARnet_tenRA is offline
Free Member
 
Join Date: Jan 2003
Location: Illinois, USA
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Here's my 2 cents: I modified the prediction function to take 2 sample sizes as input. Provides for a bit better accuracy. I also called it predict2 so that it will not be confused with the original.
Code:
#------------------------------# 
# Prediction Function 2        # 
#------------------------------# 
function Predict2 (clip c, string "movie", float "cds", int "cdtime", float "factor", float "Samp1", float "Samp2", float "CQ1", float "CQ2", int "AudioBitrate") 
{ 
movie = default(movie,"No_Title_Defined") 
factor = default(factor,1) 
cds = default(cds,1) 
cdtime = default(cdtime,80) 
Samp1 = default(Samp1,0) 
Samp2 = default(Samp2,0) 
CQ1 = default(CQ1,0) 
CQ2 = default(CQ2,0) 
AudioBitrate = default(AudioBitrate,128)

mSeconds  = framecount(c)/framerate(c) 
mFrames  = framecount(c) 
sFrames = framecount(SampleClip(c)) 
CDkBytes = (((cdtime*10)-5)*1024)*cds 
Desired = (((((CDkBytes-((AudioBitrate/8)*mSeconds))*sFrames)/mFrames)*factor))/1000 
NewCQ=(samp1==0)?50:(CQ1+((CQ2-CQ1)*(Desired-Samp1)/(Samp2-Samp1)))

d=BlankClip(c,1,544,480). 

\Subtitle(movie, 272,40, halo_color=$5500FF, text_color=$FFFFFF, font="Courier", size=27, align=5). 

\Subtitle("Total Frames : " + String(mFrames), 80,60). 
\Subtitle("Sample Frames : " + String(sFrames), 80,80). 
\Subtitle("Time (sec) : " + String(round(mSeconds)), 80,100). 
\Subtitle("Time (min) : " + String(round(mSeconds/60)), 80,120). 

\Subtitle("Sample 1 = "+LeftStr(String(Samp1),5)+" :   CQ 1 = " + LeftStr(String(CQ1),4), 270,60,text_color=$FF0000). 
\Subtitle("Sample 2 = "+LeftStr(String(Samp2),5)+" :   CQ 2 = " + LeftStr(String(CQ2),4),270,80,text_color=$FF0000). 
\Subtitle("Min. Audio Bitrate : "+ String(AudioBitrate)+" kbps",270,100,text_color=$FF0000). 
\Subtitle("Desired Sample Size (mb) : " + LeftStr(String(Desired),5),270,120,text_color=$FF0000). 
\Subtitle("Try New CQ = " + LeftStr(String(NewCQ),5),270,140,text_color=$FF0000). 

\Subtitle("Desired Sample Size (mb) for " + LeftStr(String(cds),4) + " " + String(cdtime) + "min CD(s):", 80,165, text_color=$FFFFFF). 
\Subtitle("- audio at  96 kbps : " + LeftStr(String((((((CDkBytes-((096/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,185). 
\Subtitle("- audio at 112 kbps : " + LeftStr(String((((((CDkBytes-((112/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,205). 
\Subtitle("- audio at 128 kbps : " + LeftStr(String((((((CDkBytes-((128/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,225). 
\Subtitle("- audio at 160 kbps : " + LeftStr(String((((((CDkBytes-((160/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,245). 
\Subtitle("- audio at 192 kbps : " + LeftStr(String((((((CDkBytes-((192/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,265). 
\Subtitle("- audio at 224 kbps : " + LeftStr(String((((((CDkBytes-((224/8)*mSeconds))*sFrames)/mFrames)*factor))/1000),5),80,285). 

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

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

\LanczosResize(width(c), height(c)) 
return d+c+d 
}
Regards, Tenra
Reply With Quote
  #56  
03-02-2003, 08:36 PM
SodGawd SodGawd is offline
Free Member
 
Join Date: Jul 2002
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to SodGawd
Hyia Kwag.. Been a LONG while since I last posted here. I have been watching this thread for little while and am very interested in what I have been reading.. I understand most of it since the scripts seem to be doing most of the work. I do have a question tho. What if you are not ripping but recording straight to MPEG-2 (DVD specs) and re-compress from there? I have a Dazzle DVC-II and recording Indy Jones and the Temple of Doom. I maxed out all my settings for maxium quality when recording. I am trying to adjust your scripts for the KDVD D1 template and I seem to be overshooting my target filesize by at least 20 MBs!! I was using CQ_VBR. I can assume that this is incorrect now. I am re-encoding right now at just CQ. Since this is for KDVD, I set the number of CDs at 2 (this is pretty close to my final target filesize). The formula states that I should use CQ 29.3(ish). That seems awefully low but will try it next. Is there any special modifications to make to allow for KDVD D1 (or even half D1)?

My apologies for the long winded post
__________________
'Indeed, you are powerful..."
Reply With Quote
  #57  
03-02-2003, 09:33 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 SodGawd,

Long time no see
Are you sure you're using the latest KDVD templates
It seems to me that the value of CQ you calculated is extremely low for CQ templates. That would be about the right CQ for the old CQ_VBR templates. So please check your template again agains the ones currently posted

-kwag
Reply With Quote
  #58  
03-03-2003, 12:49 AM
SodGawd SodGawd is offline
Free Member
 
Join Date: Jul 2002
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to SodGawd
Quote:
Originally Posted by kwag
Are you sure you're using the latest KDVD templates
Yah.. I DL'd them late last month. About 2 weeks ago, maybe.

Quote:
It seems to me that the value of CQ you calculated is extremely low for CQ templates. That would be about the right CQ for the old CQ_VBR templates.
Yuppers.. I thought the same. I went back and poked around the forums some more and found that in KVCD Predictor that the Sample points is supposed to be the number of minutes that the movie runs. I only had one hundred and an error % of 5 instead of 2. Has since been changed and I am getting arond 68.2 for the CQ (NOT CQ_VBR). Thanks for the quick response.

Also, since I am compressing VHS (29.97fps/interlaced) I am trying to see if I get a noticable diff between IVTC and Interlaced.
__________________
'Indeed, you are powerful..."
Reply With Quote
  #59  
08-30-2003, 08:47 PM
r6d2 r6d2 is offline
Invalid Email / Banned / Spammer
 
Join Date: Jun 2003
Location: Voyager II
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Hi, Kwag. Long time no see

I've been doing mostly CCE lately and playing with Q prediction. I implemented a variant of Newton's method to find roots of an equation to find a suitable Q for RoBa in 3 to 4 tries, outsmarting binary search.

I recently expanded my simulator spreadsheet to support TMPGEnc's CQ mode. I though you might be interested in taking a look at this thread in Doom9's forum:

http://forum.doom9.org/showthread.php?s=&threadid=60191

This stuff might turn out to be useful for CQMatic.

Best regards,
Reply With Quote
  #60  
08-30-2003, 10: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
Hey thanks r6d2
I'll take a look now!

-kwag
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




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