AWS Thinkbox Discussion Forums

Watermarking a movie

Does anyone have any experience using Draft to watermark a movie (.mov or .avi)? Is the process similar to creating a frame counter?

docs.thinkboxsoftware.com/produ … unter.html

Thanks.

Yes, the process is nearly the same. The only difference is that you’ll use an image that you read from a file, instead of creating a text image:

#Set up the decoder
decoder = Draft.VideoDecoder( "path/to/clip.mov" )
image = Draft.Image.CreateImage( 1, 1 )

#Load the watermark image
watermark = Draft.Image.ReadFromFile( "/path/to/load/watermark.png" )

#Set up encoder
encoder = Draft.VideoEncoder( "path/to/save/video.mov" )

while decoder.DecodeNextFrame( image ):
    #Composite watermark onto frame
    anchor = Draft.Anchor.SouthEast
    compOp = Draft.CompositeOperator.OverCompositeOp
    image.CompositeWithAnchor( watermark, anchor, compOp )

    #encode the frame
    encoder.EncodeNextFrame( image )

encoder.FinalizeEncoding()

Thanks for the reply! This looks pretty straight forward. I do have question about this line of code:

image = Draft.Image.CreateImage( 1, 1 )

Should I use the size of the of the movie when creating the image? For example, if the movie is 640x480, then the image I would create is:

image = Draft.Image.CreateImage( 640, 480 )

The Decoder will override the width and height with the actual frame dimensions from the loaded video.
This way, the script is independent from the actual image size of the input stream, and you don’t have to modify it just because the input video resolution changed - it will resize automatically.

There does not seem to be any info about this detail in the docs or the Draft Cookbook, so I have requested this info to be added in a future update.

Thanks for the feedback!

Awesome! Thanks!

Privacy | Site terms | Cookie preferences