Friday, July 24, 2009

Watermark your Videos

fsp:Creative Series

Have you ever wanted to watermark your video with your name or company or whatever? I mean like how YouTube stamps its logo an all videos, it is easy that I thought. I have been working on it for a good one hour and guess what it works and its not rocket science, even I can do it.

Platform: the tools used
  • platform: Ubuntu Jaunty (9.04)
  • media player: mplayer
  • image editor: gimp
  • watermarking tool: ffmpeg using the vhook library
NOTE: The default ffmpeg on the Ubuntu repository does not have vhook enabled. You may have get the source code and compile it with vhook enabled.

Compiling ffmpeg
  1. Download the ffmpeg
  2. Untar it: tar jxfv ffmpeg-xx.xx.tar.bz2
  3. Get into the untared folder: cd ffmpeg-xx.xx/

  4. Configure with the vhook enabled: ./configure --enable-gpl --enable-nonfree --enable-vhook. Run ./configure --help to get a full list of options. NOTE: the . in the commands above is part of the command, so put it there.
  5. Compile and Install: make && make install
  6. vhook files will be located in the /usr/local/lib/vhook
Ingredients: the verges and spices
  • video to be watermarked:
  • the image to watermark the video. NOTE: the image background must be of color: #808080 and of the same size as the video.
Creating the watermarking images
  1. Play the video from the console/terminal to get the size of the video: mplayer thetrain.mpg
  2. Read the size of the video from the info displayed when mplayer loads the video, see the image below.
  3. So the create an image with the same size as the video, in this case it is 640x480 pixels. Remember the background of the image must be #808080, then add all that you want. Here is mine.
  4. Now we set, its time to cook

Cooking: frying and boiling
  • To make it easy, put all the ingredients in on pot, oops sorry, in one folder. The naviget on the terminal to that folder. Here is the generic structure of the command to watermark: ffmpeg -sameq -i original-video -vhook ' -f overlaying-image' output-file. The sameq force the ffmpeg to maintain the same quality in and out. There is my cooking: ffmpeg -sameq -i thetrain.mpg -vhook '/usr/local/lib/vhook/ -f overlayer.png' thetrain.fsp.mpg.
  • Prepare the table and save the food. Use mplayer to try your newly watter marked file

Delicious: what goes to the table

See what we served on the table

Try It and tell me! Have fun guys!.

No comments:

Post a Comment