Log in

View Full Version : Prerotation made simple


homermaster
12th April 2005, 18:06
I originally posted under the topic "prerotating video for palm" and tried to add this to the thread but I was never able to view it. Sorry if not knowing how this forum works is causing problems but I wanted to offer a simple solution to those who are looking for ways to make this happen.
I'm not sure if this is an option that will be added in to AutoGK or not... I'm still hoping so. However, I have been playing around with things a little and have discovered a simpler way to rotate the video. It requires that there are two passes made for the video processing, which will definately happen if you are making the video small enough for a Palm or PocketPC. It does require you to pay attention to the encoding process though.
The first thing is to set up AutoGK like any normal encoding and start it. It will go through a number of steps that you can keep track of through the log window in AutoGK. When you see the line "Running First Pass" a file will be created in the agk_tmp folder called *_movie.avs. You will need to open this file with Notepad and at the end of it add the line turnright(). Here is an example of an avs script I edited...


LoadPlugin("C:\PROGRA~1\AutoGK\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\AutoGK\filters\autocrop.dll")

movie = mpeg2source("C:\Documents and Settings\Aaron\Desktop\agk_tmp\Napoleon Dynamite.d2v")
cropclip = autocrop(movie,mode=0,wmultof=4,hmultof=4,samples=10,aspect=0,threshold=34,samplestartfram
e=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
fixed_aspect = 1.18518518518519
c_width = width(cropclip)
c_height = round(height(cropclip) / fixed_aspect)
input_par = float(c_width)/float(c_height)
input_par = input_par > 1.4 ? input_par : (4.0/3.0)
out_width = 480
out_height = round(float(out_width) / input_par)
hmod = out_height - (floor(out_height / 16 ) * 16)
out_height = (hmod > 4) ? (out_height + (16 - hmod)) : (out_height - hmod)
new_aspect = (float(out_width) / float(out_height)) / fixed_aspect
autocrop(movie,mode=0,wmultof=4,hmultof=4,samples=10,aspect=new_aspect,threshold=34,sample
startframe=0,leftadd=0,rightadd=0,topadd=0,bottomadd=0)
BicubicResize(out_width,out_height,0,0.5)
turnright()


This MUST be added before the second pass is started. If you have done this correctly your encoded video from AutoGK will be rotated 90 degrees to the right. YEA!!

len0x
12th April 2005, 19:27
This will totally screw your encoding as you can't use first pass stats file from a different (essentially) source for the second pass.

homermaster
14th April 2005, 00:24
sorry ... i'm definately in no position to say that you are wrong. However the only anomolus result I have seen with 10 encoding sessions so far is that the file size is 1 meg short of the target... and i'm not sure that it is even caused by the turnright() command. The resultant video still looks great. I hate to be such a lay person but could you provide a breif explanation of what will be screwed up? I thought the stats file you are referring to simply gave info on where (timewise) to allocate a higher or lower bitrate and not specifically position in the video field. Sorry if im just an idiot but I do want to learn. I love this tool and want to use it effectively.

jggimi
14th April 2005, 01:18
MPEG compression works through the use of a number of interesting technologies. There's much more to motion picture compression then the compression of a still photograph. For example, both the motion of objects within the frame, and camera movements are taken into account as part of the compression algorithms.

Len0x is concerned that the examination of each frame that the codec produces during the first pass will not be taken into account properly in the second pass.

For a lot more on MPEG technologies, I recommend looking through the DivX User Guide (http://www.divx.com/divx/divxpro/guides/), even if you don't use DivX. The explanations of MPEG technologies, such as macroblocks, motion vectors, and quantizers are helpful to the understanding of the encoding process. It is explained very clearly, with graphics that show the encoding process, and is available in four languages.

homermaster
14th April 2005, 16:33
Thank you again .... LOTS of stuff to learn. I appreciate your patience and willingness to help.