Loading...

quicktime-api@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

RE: Question on how to overlay a still image onto a video track. (aka watermarking video) Steve Slover Fri Feb 03 14:09:12 2012

Hi Neal,

 

Thanks for the response. I have used the same general idea you described
to put the watermark in a separate track and have it working for the
most part. I opened the watermark as a movie so it was pretty easy to
lay it down as a second track to the video. Unfortunately it shouldn't
be too difficult for someone to remove that track making the video
invalid.

 

My ultimate goal is to end up with one video track containing both the
original video and the watermark. This probably means I will have to
unpack the video and overlay the watermark frame by frame unless someone
can suggest a better way.

 

As a first step towards that end, I've changed the code to import the
watermark as a GraphicsImportComponent instead of a Movie. After
clipping, translating, etc, I'd like to lay it down on a secondary track
to the video to test it out, but I don't know the steps to massage a
GraphicsImportComponent into a track.

 

Then, the final exercise, will be to figure out how to overlay the
watermark into each video frame.

 

The tool I'm building will be cross-compiled for both Windows and Apple
so I'll have to stay with the Quicktime C API for development. I've done
similar things with other graphics libraries but this is my first time
working with Quicktime. The original video will be in a .mov format and
the watermarks are expected to be either .png or .bmp files.

 

Steve

 

________________________________

From: Davis, Neal [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 01, 2012 12:36 PM
To: Steve Slover; [EMAIL PROTECTED]
Subject: RE: Question on how to overlay a still image onto a video
track.

 

Steve;

 

I can maybe help lead you in the right direction - I don't use the C API
directly, rather the ActiveX in .NET C#, but I think it will be closely
related on how to overlay a watermark.

 

You need to put the watermark graphic in a separate video track that is
parallel with and the same length as the main content video track. The
logo video track must be above the content track in the z-order. In the
quicktime activex Movie object the easiest way to do this is to call the
AddScaled() method which will put any image that you copy to the
clipboard into a separate quicktime movie track.

 

There are properties of the Movie.QTTrack object that let you position
the watermark/logo. Also you can set the QTTrack.TransferMode
properties; to control alpha blending and many other settings - there
are several properties of TransferMode (you need to look at
QTTransferModesEnum) and also of the QTTrack (like HighQualityMode which
you should probably set).

 

I don't know how all this QT ActiveX stuff transfers over to the QT C
API because I never used the QT C API? If the QT C API has the concept
of a Movie and QTTrack and you've used those then it may not be to hard
to figure out. You didn't say what platform you are developing on but as
you can see I have done graphic overlays in Visual Studio .NET 2008
using Quicktime ActiveX (windows XP platform obviously).

 

If your talking about a windows platform you could probably develop a
prototype showing a watermark on top of a video using the QT ActiveX in
Visual Studio in a day or two just to see it work; then figure out how
to do it in the native C API after that? Maybe you'll decide to just use
the ActiveX - it's a lot easier to use than the raw C API and let's you
access very low level quicktime if desired.

 

I don't claim to be a quicktime expert I refer to the book "QuickTime
for .NET and COM developers" often and much of the information above is
taken from pages 171-174 of that book. Author is John Cromie he is
definitely the expert, he helped developed the Quicktime ActiveX for
windows at Apple.

 

Neal Davis

CBS Digital

 

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Steve Slover
Sent: Tuesday, January 31, 2012 5:48 PM
To: [EMAIL PROTECTED]
Subject: Question on how to overlay a still image onto a video track.

 

I am writing a tool that needs to apply a watermark to a video file. I'm
using the C Quicktime api and the watermark resides in a png file. I'm
able to use the various GraphicsImport functions to open the watermark,
apply clipping, translation and set graphics mode to straight alpha,
etc. At this point the watermark image is being manipulated as a
GraphicsImportComponent, what are the steps needed to convert this to
something I can overlay onto a video track? Do I need to convert it to a
handle or a data ref or something similar? What function calls will get
me there? I don't think this should be too difficult, but this is my
first time using Quicktime so I still have a lot to learn.

 

Thanks for any help.

 

Steve

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quicktime-api/alexiscircle%40gmail.com

This email sent to [EMAIL PROTECTED]