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.