VideoCore-Inactive icon indicating copy to clipboard operation
VideoCore-Inactive copied to clipboard

Watermark

Open t2wu opened this issue 9 years ago • 10 comments

Is there watermark support in this? It's listed in the Architecture overview, but I could not find the code.

t2wu avatar Mar 19 '15 08:03 t2wu

VCSimpleSession has a method on it to add an image onto the stream:

- (void) addPixelBufferSource: (UIImage*) image withRect: (CGRect) rect; 

Worked like a charm for me.

jacobmoncur avatar May 01 '15 06:05 jacobmoncur

Wow thanks, I guess the sample project pull the old version of the code and it was not in there. Let me take a look. Do you think it would be hard to modify it so that instead of a static watermark, I can have animation printed on it?

t2wu avatar May 05 '15 08:05 t2wu

@t2wu the best way to do this right now would be to create your own source more or less based on the static image source and add it to a graph that you have control over (could be based on the VCSimpleSession graph, but with your custom sources added)

jgh- avatar May 08 '15 03:05 jgh-

Hi guys,

I'm trying to add a static watermark but I'm having trouble to understand how the sizing works. I read the comment in addPixelBufferSource, but it's not very clear to me:

/*!
 *  Note that the rect you provide should be based on your video dimensions.  The origin
 *  of the image will be the center of the image (so if you put 0,0 as its position, it will
 *  basically end up with the bottom-right quadrant of the image hanging out at the top-left corner of
 *  your video)
 */
- (void) addPixelBufferSource: (UIImage*) image withRect: (CGRect) rect;

So imagine I have a video of 960x540 and I want to add a watermark image of 100x30 pixels at the top-left corner. What values should I use for the rect parameter?

Thanks!

germanSancho avatar May 21 '15 15:05 germanSancho

Hey German

What I mean by that is that the center of your image is the origin point, (0,0) represents the top-left of the video. So if you make the image's position (0,0) the center of the image will be aligned at the top-left of the video and most of the image will not be visible.

If you make the image's position (videoWidth/2, videoHeight/2) it will be centered in the video.

jgh- avatar May 21 '15 22:05 jgh-

Hi James, about adding my own source to create dynamic watermarks, any source whose output is set to m_videoMixer, and is registered by m_videoMixer will get mixed in? A source that is registered later in time overlays one registered previous in time?

I didn't seem to grasp this thing until I viewed the WWDC video on AVAudioEngine which also has term like "mixer" and it seems to clarity your code for me.

t2wu avatar May 22 '15 09:05 t2wu

ok @jgh- , thanks for the tip!

germanSancho avatar May 22 '15 13:05 germanSancho

try with a squared watermark image. I believe the oroblem is the dimensions of your image. 

On Wed, Mar 23, 2016 at 1:59 AM -0700, "michalsenk" [email protected] wrote:

— You are receiving this because you commented. Reply to this email directly or view it on GitHub

omarojo avatar Mar 23 '16 17:03 omarojo

is it possible to remove the watermark at a later point?

haemi avatar Apr 01 '16 12:04 haemi

@haemi Do you find the way to remove the watermark?

Thank you.

Jasonzn avatar Oct 03 '16 02:10 Jasonzn