I have a way of calculating AVC bit rate based on the dimensions and frame rate of the output video.
However, I need a way of dumping the output resolution and frame rate of an AVISynth script in a batch file before it is encoded with x264.exe.
The reason for this is that I wrote a batch file to generate an AVIsynth script based on a template. It injects the input file name (including path) and the DAR of the input video. The AVIsynth script automatically resizes it to a width and height divisible by 4 and no greater than 480x272. I would use the DAR of the input file, except that my application is designed to handle Autocrop. Autocrop is a feature that I would really like to keep.
I am attaching the template AVISynth script below. (%FILE% and %DAR% are replaced with the appropriate values when the script is generated)
I would really appreciate some help on this.
Script:
Code:LoadPlugin("Autocrop.dll") Input_Clip = DirectshowSource("%DAR%").converttoyv12() DAR = %DAR% if_width = Input_Clip.Width hf = float(if_width) / DAR if_height = round(hf) ifs_width = Round(float(if_width/2))*2 ifs_height = Round(float(if_height/2))*2 Input_ClipS = Input_Clip.autocrop(mode=0).LanczosResize(ifs_width,ifs_height).Autocrop(mode=0) i_width = Input_ClipS.Width i_height = Input_ClipS.Height D_A_R = float(i_width) / float(i_height) p_o_height = (d_a_r < 1.7647058823529411764705882352941) ? 272 : 480/float(d_a_r) p_o_width = (d_a_r < 1.7647058823529411764705882352941) ? 272*d_a_R : 480 p2_o_width = Round(p_o_width/4)*4 p2_o_height = Round(p_o_height/4)*4 o_width = Round(float(p2_o_width)) o_height = Round(float(p2_o_height)) first = Input_Clip.Framerate*1000 second = Round(Float(first)) FPS_oi = int(second) FPS = (FPS_oi > 30000) ? 29970 : FPS_oi QuantA = (i_width < 480) ? 1 : 0 QuantB = (i_height < 272) ? 1 : 0 QuantC = QuantA + QuantB Output = (int(QuantC) == 2) ? Input_Clip.changefps(int(FPS), 1000).converttoyv12() : Input_Clip.changefps(int(FPS), 1000).LanczosResize(o_width,o_height).converttoyv12() Return Output
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Media Info Not seeing all subtitles
By cal_tony in forum SubtitleReplies: 0Last Post: 15th Apr 2012, 22:43 -
Verbatim LTH Media...Info
By New Bee in forum MediaReplies: 2Last Post: 13th Feb 2011, 05:58 -
Media Info query
By Bully9 in forum Newbie / General discussionsReplies: 3Last Post: 7th Feb 2011, 08:54 -
MKV H.264 media info
By stiltman in forum Newbie / General discussionsReplies: 5Last Post: 16th Jan 2010, 17:00 -
what do you use to browse file's media info?
By EricG in forum Newbie / General discussionsReplies: 3Last Post: 11th Oct 2007, 18:58