Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
21st January 2012, 12:50 | #1 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Watermark?
Is there a filter/function for 'watermarking' a video?
By 'watermarking' I mean writing text by deforming the video - an effect like placing glass lettering on top of a picture. Or anything similar would do - adding text without hiding too much of the video. I imagine that this has already been done, but do not know what to search for. Thanks in advance for any help you may be able to give. Phill |
21st January 2012, 13:22 | #2 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Try search on "logo watermark" perhaps limiting to the Avisynth Usage forum.
EDIT: or to find those words including CODE blocks in search, google logo watermark site:forum.doom9.org
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 21st January 2012 at 13:26. |
21st January 2012, 15:43 | #3 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Maybe the standard Overlay filter will work for this:
http://avisynth.org/mediawiki/Overlay If you have a 32-Bit PNG file with proper Alpha (transparency) information, it can be applied like this: Code:
Image = ImageSource("C:\Your Overlay.png", pixel_type="RGB32") Overlay(Image, mask=Image.showAlpha())
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 21st January 2012 at 16:23. |
24th January 2012, 11:32 | #4 | Link | |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Quote:
Maybe I need to work up an algorithm..... But thanks anyway for the suggestions. Phill |
|
24th January 2012, 13:11 | #5 | Link |
Registered User
Join Date: Jan 2006
Location: Finland
Posts: 134
|
You could probably achieve something like that by using the mask to cut out the corresponding area of the image and shrink/expand/displace it by a little. Do this a couple of times and then overlay them all on top of each other on the original image. Add a bit of blur if needed.
|
24th January 2012, 13:17 | #6 | Link |
Registered User
Join Date: Mar 2006
Posts: 1,049
|
sounds like perfect task for http://forum.doom9.org/showthread.php?t=161852
|
24th January 2012, 13:20 | #7 | Link | |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Quote:
But it is certainly worth kicking these ideas arround as I have not thought them out well enough yet. Phill |
|
24th January 2012, 13:27 | #8 | Link | |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Quote:
(I started with leaning to play the whistle, then recording and mastering the tunes, then on to making videos, followed by video editing, writing AVISynth plugins in C, now OpenGL? 'What a long strange trip its been....) |
|
25th January 2012, 17:21 | #9 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Turns out that it is relatively simple - I have attached a zip with the DLL and a sample script. I left out the example mpg as it was fairly large and I am sure you all have some samples.
I will tidy up the code and documentation if there is enough interest. Let me know what you think. Thanks Phill |
25th January 2012, 20:09 | #10 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
|
Virtualdub says "Access violation in watermark.dll" and collapses.
WinXPSP3, Graphic card GTX7950.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." Last edited by Emulgator; 25th January 2012 at 20:51. Reason: Mistyped a " as 2 |
25th January 2012, 20:19 | #11 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Thanks Emulgator (I think!). And sorry for any wasted time.
Seemed to work alright in AVISynth. I am not sure what to do now - I have no idea how to debug a plugin. I cannot see me mustering the enthusiasm to learn what I need to build an industrial strength solution - at least not while it is doing what I want. I can make the source code available to anyone interested. The effect of the filter is to deform the clip as if there are lumps behind the screen. The lumps are defined by a black-and-white clip. Phill |
25th January 2012, 22:24 | #13 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Thanks for the reassurance, Librarian. I have probably messed up slightly with my pointer arithmetic, but in a way that does not show on our platform. I have a couple of mods to sort out, then I will tidy the source code and publish it.
Maybe someone will give it the once-over for mistakes. Phill |
25th January 2012, 22:32 | #14 | Link |
Big Bit Savings Now !
Join Date: Feb 2007
Location: close to the wall
Posts: 1,531
|
Looks good !
The GTX7950Go supports up to Open GL 2.0, maybe this is not enough... I will try my luck later on...
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain) "Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..." |
26th January 2012, 07:38 | #15 | Link | |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Quote:
I am grateful to Librarian for posting a pic. Some notes: - the width of the border around the watermark is parameterised. - the maximum intensity of lightening/darkening of the border is parameterised - the lightening/darkening is graded from watermark to background - the offset of the image in the watermark is parameterised This means that the effect can be altered from very subtle to very not-subtle. |
|
26th January 2012, 13:06 | #16 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
I am tidying up the code.
I have added some features: - Specify light direction - Specify light amount - soft or hard edges - depth - image displacement Are there any other features that might be useful? I wondered whether making it dynamic would be good - the watermark could move/change. This may slow processing down a bit but should be simple to implement. I also wondered if using a grey scale to indicate the height/displacement might be effective. I am not sure how I would calculate the lighting though. Any thoughts? Would a colour shift be useful in the watermarked area? Any thoughts appreciated. Phill |
26th January 2012, 16:14 | #17 | Link |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
OK, dynamic watermarking was simple. New DLL attached.
I have a new filter for testing called moveIt which can be used to move the watermark in a fairly boring fashion to illustrate that this works dynamically. Details in example.avs in the zip. Feedback welcome, as are offers of help to make the C code up to 'platform independent' quality. Thanks Phill |
26th January 2012, 18:31 | #19 | Link | |
Registered User
Join Date: Dec 2011
Location: West Somerset, UK
Posts: 130
|
Thanks - and with motion it goes beyond my initial goal, and opens up some interesting posibilities. I am now investigating tools to create animated 'watermarks'. Floating music notes and the like...... Gimp is a contender.
Quote:
Certainly. It functions as a plugin on at least two machines (thine and mine) so it is on the way to being useful. I really just bashed together an algorithm in C without worrying too much about portability and the like. I have been spoilt by Java I guess. And this shows in as much as Emulgator had problems - and I have neither the knowledge nor the tools to do much about it. I have commented the code and will create a SourceForge project for it. Phill |
|
27th January 2012, 00:02 | #20 | Link |
Registered User
Join Date: Nov 2011
Posts: 63
|
Portability
A (not too quick) experiment. I created a virtual machine with Virtual Box (latest available version, freshly downloaded) and installed Windows XP SP3 professional, Avisynth 2.5.8 and Xvid 1.3.2.
I run your script, the result is the expected one (see linked image) Therefore there are at least 3 machines which can run your plugin:yours,mine,a virtual XP (but I think there are many more):-) If I find the time I'll try with linux and wine. |
Thread Tools | Search this Thread |
Display Modes | |
|
|