Skip to main content

Brighter Computer Solutions

Home & Business Computer Services

About Us
Contact Us
Site Map
Member Login
Home Services
Business Services
Free Helpful Essentials
Virus Alerts
Product Reviews
How To Articles
Make Windows Safer
Use A Rescue CD
Video Watermarks
Memory Problems
News and Events
Custom Utilities
Add Watermarks to Your Videos

Ever wanted to put your name on your creations or add that professional appearance to your online video series?

A watermark is the perfect way to let viewers know who created a particular video no matter where it goes.

In my own YouTube video publishing activities I have found that most useful free video editing tools are too difficult for the average non-programmer or non-linux enthusiast to use. I have restricted my toolkit for this project to precompiled free applications that make command line based video editing tools accessible to the above average Windows user.

In this How-To, I will list the required utilities, what video formats can be used for input and watermark logo, steps for script and video setup, and steps for video output.



Here is a short list of the tools that I will use in this 'how to'.

All of these tools are listed in the video section of our Free Helpful Essentials page.

Also Required: Patience and some exposure to scripting languages.

Avanti: an easy to use GUI (graphical user interface) front end for FFmpeg and AviSynth.
AVISynth: a non-linear video editing tool with a scripting language. It works as a frame serving application, meaning that there are no temporary files created during the editing process.
FFmpeg: a powerful command line based video conversion utility with many advanced features. It supports most video file formats for input and output.
MediaCoder: a powerful GUI based video conversion utility with many advanced features. It supports most video file formats for input and output. A customized build of FFmpeg is the back end for this free video conversion utility.
Initial Setup

1. Download all utilities (using the links on our Free Helpful Essentials page.)
2. Install AVISynth and MediaCoder, these are the only two utilities with installers.
3. Unzip the Avanti file to a convenient location (like C:\Avanti) but don't run it yet. Avanti is a 'portable app' meaning that it can be extracted and run without any installation.
4. Extract the FFmpeg files into the ffmpeg folder in the Avanti directory (in our example C:\Avanti\ffmpeg\).

Supported Video Formats

The AVISynth DirectShow plugin supports most video formats that Microsoft's Windows Media Player can play. The format that I will be using for this demonstration is MPEG2. If your file format is not supported, you can always convert it to a format that AVISynth understands using MediaCoder or Avanti (or FFmpeg from the command line if you read through the documentation).

DeMux Video and Audio

AVISynth reads one stream per file for most video formats, this means that we must first split our video into two separate files, one for video and one for audio. I recommend using MediaCoder to produce a MP3 of the video file's audio stream.
1. Skip the configuration wizard, click 'launch MediaCoder.'
2. Make sure that the user interface mode is 'Normal' (Options->User Interface Mode->Normal Mode.)
3. Click the Video tab and uncheck Enabled.
4. Click the Audio tab and select MP3 as the format. Choose any CBR (Constant Bit Rate) preset or cusomize to your liking.
5. Click the Container tab and select Default.
6. Click the yellow plus symbol to add your video file.
7. Click the start button to begin transcoding.
When transcoding has finished, MediaCoder will display a dialogue summarizing the results. Click OK and exit MediaCoder. MediaCoder by default will produce the MP3 file in the same directory as your original video.

AVISynth Script

AVISynth reads script files that you write and applies the filters, layers, and effects to the video file specified. Note that variables such as vid, aud, ovl, etc will be used to keep track of individual elements.
The AVISynth commands (or functions) we will be using are as follows:
.ConvertToRGB32 Converts the input to the specified pixel format (32 bit RGB).
.ConvertToYUY2(matrix="rec709") Converts the input to the specified pixel format (raw YUY2).
LoadPlugin([path]) loads the specified plugin function dll for use.
In my example script this line will be:
LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DirectShowSource.dll")
DirectShowSource([path]) loads the specified video or audio file for processing using DirectShow.
In my example script this line will be:
ImageReader([path], start frame, end frame, frame rate, use DevIL, write info, pixel type) Loads the specified image file using the specified number of frames, frame rate, parser, and pixel type. If the image file is a single static image use start frame of 0 and end frame of 1. Frame rate should be set to match the frame rate of your original video (usually 29). The fields use DevIL and write info should be false. Pixel type must be RGB32 for the next video processing steps.
In my example script this line will be:
img=ImageReader("C:\Videos\logo.png", 0, 1, 29, false, false, "RGB32").ConvertToRGB32
ColorKeyMask(image, color code, tolerance)
If your image file does not have transparency built in (alpha channel) one color will need to be made transparent. Your logo file should have a single color background that does not appear anywhere else in the logo or else transparent 'holes' will appear wherever that color is present. The color code for white is $FFFFFF, black is $000000. Tolerance is best left at zero.
In my example script this line will be:
img=ColorKeyMask(img, $FFFFFF, $000000)
The first parameter is the video clip we will be watermarking, the second is the image (or animation) the third is the type of operation we will perform (in this case add) with the specified mixture/opacity (255 is all image, 0 is all video) at the specified x,y position.
In my example script this line will be:
Dub the audio stream of the second parameter over that of the first.
In my example script this line will be:
Example Script

Now that I have provided a short description for each function in the script, here is the complete script for your modification. Simply change the path to the video, audio, and logo files to that of your own video, audio, and logo files then adjust the x,y position of the logo over your video.
#Load the DirectShowSource Plugin
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DirectShowSource.dll")
#Load the audio source
#Load the video source
#Load the overlay image and convert to a clip
img=ImageReader("C:\Videos\logo.bmp", 0, 1, 29, false, false, "RGB32").ConvertToRGB32
#Make 'white' transparent
img=ColorKeyMask(img, $FFFFFF, $000000)
#Overlay the image onto the video
#return the video with image overlay with audio remixed
Copy the example script and paste it into Notepad or another text editor (like Notepad ++) and save it with a .avs extention (instead of .txt).

Demo Your Video

Double click on your video, if prompted choose Windows Media Player or another media player.
If you see a message in red text, it indicates an error either with the script syntax, file location, or a plugin. Note the location (Line number etc) and look in your script.
Adjust your logo/watermark position as required (remember the last two parameters for Layer).
Using Avanti to Save Your Video

Launch Avanti and watch the status/log window towards the bottom. The last item displayed should be "Valid FFmpeg/AVISynth combo found ..." this means that the FFmpeg files were placed in the correct location and that the AVISynth engine is functioning correctly.
1. Click the folder next to the Source 1 field and find your avs script.
2. Click the folder next to the Destination field and select a location for the final video.
3. Choose your audio and video format and bitrate. I use 128kbps aac with 800kbps 720x480 mpeg4 video. Note that framerate conversion is often neccessary. 29.970 is normal for NTSC video.
4. Click Start process to begin the conversion process.
If everything goes as expected Avanti should produce a video where specified with your own logo.
If Avanti does not work for you, someone named Lukas has found a solution.

From his email he recommends to directly use FFmpeg - like this:

ffmpeg -i input.avs -sameq output.mpg

We would like to thank Lukas for his solution and thank you for reading!