digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Manual File Prediction: Mini How-to Guide (http://www.digitalfaq.com/archives/avisynth/1938-manual-file-prediction.html)

rendalunit 02-04-2003 08:53 PM

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 :lol: :lol:

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

ozjeff99 02-05-2003 01:42 AM

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

kwag 02-05-2003 02:07 AM

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 :wink:

-kwag

rendalunit 02-06-2003 07:50 PM

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 :wink: 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!!!! 8)

vhelp 02-06-2003 08:11 PM

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

rendalunit 02-06-2003 08:20 PM

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 :oops:
ren

vhelp 02-06-2003 08:39 PM

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 :roll:
(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

jorel 02-06-2003 10:57 PM

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 :wink: 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!!!! 8)

8O ....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! :wink:

TCC 02-21-2003 04:29 AM

Sorry for the long post :? I copied and pasted the code by rendalunit and ran it in WMP and got an error stating:
http://www.digitalfaq.com/archives/error.gif
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 :lol: :lol:

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(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,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
}

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
}


rendalunit 02-21-2003 05:43 AM

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

TCC 02-21-2003 07:13 AM

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
}


TCC 02-21-2003 08:18 AM

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 :lol:

kwag 02-21-2003 09:56 AM

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 :D
Quote:


Boy, do I feel like I'm back in school :lol:
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 :lol:

-kwag

TCC 02-21-2003 12:47 PM

FINALLY :!: :!: :yippie: It's working :)

Thanks rendalunit and kwag. http://www.digitalfaq.com/archives/error.gif
Now I can go to sleep while it encodes :lol:

ARnet_tenRA 02-27-2003 11:39 PM

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

SodGawd 03-02-2003 08:36 PM

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 :)

kwag 03-02-2003 09:33 PM

Hi SodGawd,

Long time no see :lol:
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

SodGawd 03-03-2003 12:49 AM

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.

r6d2 08-30-2003 08:47 PM

Newton's Method to predict CQ
 
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,

kwag 08-30-2003 10:10 PM

Hey thanks r6d2 :D
I'll take a look now!

-kwag

muhali3 11-08-2003 11:51 AM

i don't know if this question has already been answered inside this thread, but i don't want to read the whole thing. does the prediction method also work for CQ_VBR?

kwag 11-12-2003 01:40 AM

Quote:

Originally Posted by muhali3
does the prediction method also work for CQ_VBR?

Yes it does.

-kwag

Encoder Master 01-04-2004 01:38 PM

*A LITTLE OFFTOPIC*

I predict my file with CQMatic with a Max. Bitrate of 2500kbps first and then I choose the TEST Sample and put it into BitrateView and look how high the max bitrate is and I change the Value and predict again. If I can put the max bitrate lower again I do it and I think it's a very good way to find out the relation between a good CQ and Max. Bitrate.

incredible 01-04-2004 03:04 PM

That also depends on the CQ Value and the main problem is that by just taking a sample (no matter if continous one or sliced one) this won't include *all* peaks of your movie so this will be just a "guess" based on your "sampler" peaks.

nighthawk 02-17-2004 02:00 PM

Is there a way to do manual file size predicition using the new avisynth 2.5? Unless I'm missing something everything here is for the 2.X version of avisynth?

I like Kwags simple script at the top of this thread but how to make it work with avisynth 2.5?

nighthawk

Prodater64 02-17-2004 02:27 PM

Quote:

Originally Posted by nighthawk
Is there a way to do manual file size predicition using the new avisynth 2.5? Unless I'm missing something everything here is for the 2.X version of avisynth?

I like Kwags simple script at the top of this thread but how to make it work with avisynth 2.5?

nighthawk

Like prediction is made in base to calculations, no matter what avisynth version use you. The difference will be in the sample file in accord with the script that you use. Just take the prediction script, put together with your encoding script (in the right way, read the thread), run tmpgenc and get a sample. When the right sample lenght is reached, just comment the prediction line (#) in the script, and you'll get the complete movie.

SCRIPT

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\bourn e.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(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,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
}

You must replace the text in red, with your own script.
Take care with the text in green.
You must comment (#) the line in blue for full encode.

nighthawk 02-17-2004 02:32 PM

where can I find athe sampler dll for avisynth ver 2.5?

Prodater64 02-17-2004 03:24 PM

Quote:

Originally Posted by nighthawk
where can I find athe sampler dll for avisynth ver 2.5?


http://wald.heim.at/redwood/511999//...ampler-2.5.dll
or
http://wald.heim.at/redwood/511999//...ampler-2.5.rar

Incredible, thanks for that .

nighthawk 02-17-2004 03:30 PM

:D :D

Thanks for the links!!!

Prodater64 02-17-2004 07:36 PM

Quote:

Originally Posted by nighthawk
:D :D

Thanks for the links!!!

Oh! Your welcome. But only for the links! Well, then I'll delete the previous post. :D :D :D

p2phunter 03-09-2004 11:30 AM

Do these plugins work with AviSynth 2.5?

LoadPlugin("C:\encoding\legalclip.dll")
LoadPlugin("C:\encoding\Dustv5.dll")
LoadPlugin("C:\encoding\FluxSmooth.dll")

Cos.. I think when I tried opening a AVS which used the functions (in these dlls), WMP displayed... it is not a valid Avisynth 2.5 function.

Dialhot 03-09-2004 12:11 PM

Legalclip is now built-in into avs2.5 and is called "Limiter".
DustV5 don't have any equivalent in 2.5 (and some are sad about that).
Fluxsmooth has a 2.5 version that you can load here :

http://www.avisynth.org/warpenterprises/

Note: as said in the hints in bottom of the message, you are not mandatory to use the provided script ! You can use your own script. So the lack of Dustv5 is not a problem.

p2phunter 03-09-2004 01:02 PM

Quote:

Originally Posted by Dialhot
Note: as said in the hints in bottom of the message, you are not mandatory to use the provided script ! You can use your own script. So the lack of Dustv5 is not a problem.

Yeah... I knew that. To be honest... I dont know what they are for... but just wanted to check them out! :) thanks for ur info though!

gio_vanni 05-02-2004 09:36 AM

Re: Manual File Prediction: A Mini "How-To"
 
Quote:

Originally Posted by kwag

Step 1: Determine the Audio file size.
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 [/color]

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")
LoadPlugin("C:\encoding\fluxsmooth.dll")
LoadPlugin("C:\encoding\sampler.dll")
LoadPlugin("C:\encoding\legalclip.dll")
mpeg2source("K:\K19\VIDEO_TS\k19.d2v")
LegalClip()
BilinearResize(672,336,0,0,720,480)
FluxSmooth()
AddBorders(16,72,16,72)
LegalClip()
Sampler()

When the encoder finishes, which should take between 3 to 6 minutes depending on how fast your machine runs, take a look at the sample file size. This is what I do to zero in faster on the correct CQ value:

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


The som from the calculate ( 11.88 Mb ) is that the sample size for only the video stream or video + audio stream?

24 where is that number for?

And is there a simple calculate for audio + video stream sample together???

gio_vanni 05-03-2004 11:42 PM

Nobody has a answer?

jorel 05-04-2004 12:23 AM

Quote:

Originally Posted by gio_vanni
Nobody has a answer?

steps one and two that you quoted have the answers for your questions:

1-the sample size for the video stream only.

2-where?...easy to understand but for me is hard to explain, please see the read-me that came with sampler!

3-your question here answer your first question ! 8O
no, cos don't need. you know the media and audio size before the prediction and the prediction will find the CQ to get the video size needed

just follow the examples posted in steps one and two!
:wink:

gio_vanni 05-04-2004 04:13 PM

Quote:

Originally Posted by jorel
Quote:

Originally Posted by gio_vanni
Nobody has a answer?

steps one and two that you quoted have the answers for your questions:

1-the sample size for the video stream only.

2-where?...easy to understand but for me is hard to explain, please see the read-me that came with sampler!

3-your question here answer your first question ! 8O
no, cos don't need. you know the media and audio size before the prediction and the prediction will find the CQ to get the video size needed

just follow the examples posted in steps one and two!
:wink:

Thanx

kwag 05-04-2004 04:20 PM

Re: Manual File Prediction: A Mini "How-To"
 
Quote:

Originally Posted by gio_vanni
24 where is that number for?

Frame rate (FPS).

-kwag

gio_vanni 05-06-2004 07:13 AM

Thx kwag

adiinbar 07-10-2004 02:02 PM

CQ_VBR
 
Hi Kwag

I was wondering if your prediction method works with CQ_VBR as well as CQ or is it a CQ only thing...


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

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.