Thursday, March 8, 2012

Water Marking Videos

Water marking / converting video formats is quite simple in Drupal and following contributed modules helps to achieve the same

FFMPEG CONVERTER

FFMPEG WRAPPER

Before installing both these modules, make sure ffmpeg is downloaded and installed on your server, you can confirm ffmpeg installed on your server by referring configuration page of the above mentioned modules.



On the back ground the following unix command will execute for you to convert / water mark your video

ffmpeg -sameq -i video1.mp4 -vhook '/usr/lib/vhook/watermark.so -f water_mark_img.jpg' video2.mp4

Where,
video1 is Video to be water marked
water_mark_img.jpg is your image to be used as a water marking
video2 is your water marked video (output)

you dont need to worry on executing this command, its given just to have an idea of how it works, your Drupal modules will take care of all these if it is configured properly

Please make sure
  • The dimension / canvas size of the video and water marking image
  • Check the exact path of ffmpeg installed and where 'watermark.so' file seated

Thanks
Devaraj















How to send HTML mail using SMTP authentication on Drupal

We had a need to send HTML formatted mail from a Drupal 7 site. We did some quick research and found the Mail system and HTML mail modules. We enabled the modules and configured them and figured We were done.

My colleague came back to me and told me that now, not only was the mail not sending as HTML, it wasn't sending at all!

Some research brought us to Using HTML Mail together with SMTP Authentication Support -- excellent!

We followed the steps in the tutorial and after creating the HTML mail / SMTP auth class we received a PHP error stating that Drupal had failed to load the class.

When you use the Mail system module to create a new class, behind the scenes it actually creates a new PHP (.inc) file and stores it in your sites /mailsystem/filename.inc . Unfortunately the file directory for the site I'm working on is outside of the Drupal root, and not easily accessible to the class loader. Along with this, we use a git deployment workflow, and the files directory is not version controlled.

Solution
We first grabbed a copy of the auto-generated file from the server, and then deleted the copy on the server. Then we added that file to a custom module using the files[] directive in the module's .info file (this tells Drupal to load the class). Finally we had to remove the existing entry for the file from the registry table of the database, making sure to remove the correct file, and that I had the generating module "mailsystem" as a WHERE clause.

Now we have a mail system class that does HTML formatting and SMTP authenticated delivery working with the appropriate modules, and it's version controlled too.

Thanks
Devaraj
Senior Developer
Group FMG