AWS Thinkbox Discussion Forums

Frame Counter jumping about

Hey guys.

We’re trying to get the Frame Counter in our Draft QT’s not to bounce around. It seems to be a Font kernal spacing issue from being right justified.

We’ve tried using both Gravity and Anchor, changing Fonts to various Fixed Width fonts, addition frame padding, etc etc.

We want the frame counter on the Top or Bottom Right but I can’t find any info on Justifying the annotations differently. A search on the Thinkbox site brings up Coming Issues:
thinkboxsoftware.com/draft-j … nnotations

-andrew

I’ll work on a quick example to throw up here… do you have a script you can send me that is close to what you want? Or one that illustrates what to avoid?

I’m assuming this example doesn’t do what you want?: http://www.thinkboxsoftware.com/draft-create-frame-counter/

Did you want the digits of the frame counter lined up from one frame to the next? Is that the problem?

Cheers,
Andrea

This is the part of the script that’s making the frame numbers:

annotationInfo.PointSize = int(height*0.05)
annotation = Image.CreateAnnotation(str("%05d" % frameNumber), annotationInfo)
bgFrame.CompositeWithPositionAndGravity(annotation, 0.95, 0.95, PositionalGravity.NorthEastGravity, CompositeOperator.OverCompositeOp)

Notice the unevenness in the counter from being seemingly right justified with unfixed kernal spacing:
[attachment=0]frameCounter_TEST.mov[/attachment]

Here’s a sample script that doesn’t look jittery to me:

[code]import Draft

Set up the decoder

decoder = Draft.VideoDecoder(“Horse.mov” )

image = Draft.Image.CreateImage( 1, 1 )
frameNumber = 1
frameWidth = 853;
frameHeight = 480;
textInfo = Draft.AnnotationInfo()
textInfo.PointSize = int( frameHeight * 0.05 )

Set up encoder

encoder = Draft.VideoEncoder( “Horse_counter2.mov”, width=frameWidth, height=frameHeight )

while decoder.DecodeNextFrame( image ):
digits = list( “%05d” % frameNumber )
digits.reverse()

# create the images for each digit
digitImages = [ Draft.Image.CreateAnnotation( str( digit ), textInfo ) for digit in digits ]

# composite digit images onto frame
xpixelpos = image.width * 0.95
xdelta = textInfo.PointSize * 0.5;
ypos = 0.95
for i in range( len( digitImages ) ):
	xpixelpos = xpixelpos - xdelta
	image.CompositeWithPositionAndAnchor( digitImages[i], xpixelpos / image.width, ypos, Draft.Anchor.NorthWest, Draft.CompositeOperator.OverCompositeOp )

# encode the frame 
encoder.EncodeNextFrame( image )
frameNumber += 1

encoder.FinalizeEncoding()[/code]
What I did was split the frame number up into digits, then comped each one separately. Let me know if this works for you. :slight_smile:

Cheers,
Andrea

Hi
This happens because of the different widths of the digits in the font your using. Try using a monospace font instead.

-b

Edit: Ooops. Didn’t read the first post good enough :slight_smile:

Andrew mentioned trying fixed-width fonts. The kerning stuff does some weird things that I’ve been having to fight with in the code underneath, so it doesn’t surprise me that even fixed-width fonts have a problem.

Privacy | Site terms | Cookie preferences