BitrateCalc
概要 †
ビットレート計算用関数
作者 †
qwerpoi
関数 †
function BitrateCalc(clip c,float "target_size",float "audio_bitrate",string "container",float "bpp_threshold") { target_size = default(target_size,700) #MB audio_bitrate = default(audio_bitrate,128) #kB/s container = default(container,"avi") bpp_threshold = default(bpp_threshold,0.170) assert((container=="avi")||(container=="ogm")||(container=="mkv"), "Valid containers are avi, ogm, or mkv") seconds = c.framecount/c.framerate audiosize = (audio_bitrate/8.0)*(seconds/1024.0) overhead = (container == "avi") ? (c.framecount)*(24+24)/(1024*1024+0.0) : \ ((container == "ogm") ? (c.framecount)*(0.069)/(1024+0.0) : \ (c.framecount)*(0.013)/(1024+0.0)) videosize = target_size-audiosize-overhead targetbitrate = videosize*1024*8/seconds bpp = (targetbitrate*1024)/(c.framerate*c.width*c.height+0.0) f = c.Subtitle("Audio Size = "+String(round(audiosize))+" MB",last_frame=1) f = f.Subtitle("Video Size = "+String(round(videosize))+" MB"+" ("+container+" overhead = "+String(round(overhead))+" MB)",last_frame=1,y=36) f = f.Subtitle("Target Bitrate = "+String(round(targetbitrate))+" kB/s",last_frame=1,y=72) f = f.Subtitle("Target Filesize = "+String(floor(videosize*1024))+" kB",last_frame=1,y=90) f = bpp > bpp_threshold ? f.Subtitle("Bits Per Pixel = "+LeftStr(String(bpp),5),last_frame=1,y=108,text_color=$00FF00) : \ f.Subtitle("Bits Per Pixel = "+LeftStr(String(bpp),5),last_frame=1,y=108,text_color=$FF0000) return f }
書式 †
BitrateCalc(clip c,float "target_size",float "audio_bitrate",string "container",float "bpp_threshold")
引数 †
- target_size
- 出力ファイルサイズ(単位:MB,デフォルト700MB)
- audio_bitrate
- 音声部のビットレート(単位:KB,デフォルト128KB)
- container
- コンテナの種類(avi/ogm/mkv,デフォルトavi)
- bpp_threshold
- 1ピクセルあたりに割り当てるビットレートの閾値(デフォルト0.170)
使用例 †
mpeg2source("D:\something.d2v") LanczosResize(640,480) BitrateCalc()
最終更新日時: 2014-03-11 (火) 03:47:16 (4056d)