Results 1 to 10 of 14

Thread: Need Step By Step Tutorial For FFMPEG Hardcoded Watermark

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2010
    Posts
    22

    Question Need Step By Step Tutorial For FFMPEG Hardcoded Watermark

    Hello,

    I have searched through out the forum for ffmpeg hardcoded watermark.
    I couldn't find or i'm unable to find.

    All i found was this:

    If you use ffmpeg for converting you can use the vhook feature ( http://ffmpeg.mplayerhq.hu/hooks.html#SEC7 ) to add image watermarks to your videos.

    You will have to read the docs and work it out yourself though....post a guide if you use this way as i dont have time to look into it.
    The above link in the qoute is not valid now.

    If you have successfully used ffmpeg hardcoded watermark,
    Pl post a step by step tutorial here.

    Thank you.

  2. #2
    Join Date
    May 2009
    Location
    On Earth
    Posts
    15

    Post FFmpeg 0.6 VIDEO HARDCODED WATERMARK

    vhook is obsolete now unless your server is using FFmpeg 0.5 most servers have upgraded to FFmpeg 0.6 . FFmpeg 0.6 uses libavfilterwich instead of adding a subtitle it adds an overlay a PNG with background transparency. So to add a water mark to videos using FFmpeg you need to do the steps below....

    **FIRST BACKUP YOUR FILES**


    • install FFmpeg 0.6 ( I used Google and found this site Using FFmpeg to add and watermark / overlay on a video )
    • make a .png of your logo with background transparency (background transparency must be the same size as the converted videos EG. 320x240). I have uploaded my logo as an example for you.
    • add the .png to your folder /include/settings/
    • edit your video_conversion.php file with the code below


    In /include/settings/video_conversion.php find the code $cmd_all = (towards the end of the file) . replace the code with the code below...

    PHP Code:
    //ffmpegflv - ffmpeg codec 11-2-10 converts to .flv With Watermark
    $cmd_ffmpegflv "$config[ffmpeg] -i '$video_src' -s 320x240 -f flv -b 900k -acodec libfaac -ab 16k -vf 'movie=0:png:/home/YOUR_USERNAME/public_html/include/settings/watermark_flvideo.png [wm];[in][wm] overlay=1:0:0 [out]' $video_flv > /home/YOUR_USERNAME/public_html/include/settings/flvid.log 2>&1 ";

    $cmd_all $cmd_ffmpegflv
    Replace "YOUR_USERNAME" with your server path username and you can adjust the quality and size to your liking. Also ONLY NEWLY UPLOADED VIDEOS WILL HAVE THE WATERMARK and vShare DOSE NOT CONVERT .FLV FILES, however I can change the file in the vShare script to convert .flv files. I hope this helps PLEASE post your questions / comments on this forum so that everyone can benefit. Thanks

    ~zelda180~
    www.80TOONS.com
    Last edited by zelda180; 12-20-2010 at 07:20 AM.
    I have a heavily modified version of vShare 2.8 beta WITH my own mobile addon at 80TOONS.com . Please let me know what you think.

    HOSTING WITH FULL vShare SUPPORT, my mobile addon support for vShare 2.8 & FFmpeg permanent video water marking at GIFTSnMORE.com . Thanks

  3. #3
    Join Date
    Dec 2010
    Posts
    22

    Lightbulb

    Hello zelda180,

    Thanks for the reply.

    I already have ffmpeg-php version 0.6.0-svn installed.

    Please read the questions below:
    --------------------------------

    1. Is ffmpeg and ffmpeg-php different ?
    2. For thumbnails I have three options, I chose ffmpeg.
    Should i select ffmpeg-php ?

    In /include/settings/video_conversion.php find the code $cmd_all = (towards the end of the file) . replace the code with the code below...
    3. As per my understanding,
    The only line i have to replace with the code u gave is:
    $cmd_all = $cmd_mencoder;
    Right ?

    /include/settings/video_conversion.php

    PHP Code:
    11 $cmd_all $cmd_mencoder;
    12
    13 $convert_3gp 
    $cmd_all;
    14 $convert_mp4 $cmd_all;
    15 $convert_mov $cmd_all;
    16 $convert_asf $cmd_all;
    17 $convert_mpg $cmd_all;
    18 $convert_avi $cmd_all;
    19 $convert_mpeg $cmd_all;
    20 $convert_wmv $cmd_all;
    21 $convert_rm $cmd_all;
    22 $convert_dat $cmd_all
    4. Most of the videos uploaded on my site are .FLV

    Also ONLY NEWLY UPLOADED VIDEOS WILL HAVE THE WATERMARK and vShare DOSE NOT CONVERT .FLV FILES, however I can change the file in the vShare script to convert .flv files.
    Please let us know the changes to be done in the vShare script.

  4. #4
    Join Date
    May 2009
    Location
    On Earth
    Posts
    15

    Thumbs up

    Hi,

    Great your FFmpeg version is the same as mine so far we are on the right page. Lets start with the first question...

    1. Is ffmpeg and ffmpeg-php different ?
    FFmpeg and FFmpeg-php are separate software however FFmpeg-php dose rely on the php software and FFmpeg video library to function. VShare uses FFmpeg-php to create thumbnail images from movies. More info is at http://ffmpeg-php.sourceforge.net/

    2. For thumbnails I have three options, I chose ffmpeg.
    Should i select ffmpeg-php ?
    I personal use menplayer because some say it gives better results. It dose not really matter witch one you choose you can always switch the settings and recreate the thumb nails in the admin section.

    3. As per my understanding,
    The only line i have to replace with the code u gave is:
    $cmd_all = $cmd_mencoder;
    Right ?
    Yes just replace the code with the one I gave you. If you want to just past the video_conversion.php code and I will past the new code.

    4. Most of the videos uploaded on my site are .FLV

    Please let us know the changes to be done in the vShare script.
    Just to let you know I am using a heavily modified version of vShare 2.8 how ever this should work on vShare 2.7, I don't see why not.

    You would need to edit 2 files

    • /include/settings/video_conversion.php
    • /include/functions_upload.php

    Add this code to the end of video_conversion.php

    PHP Code:
    $convert_flv $cmd_all
    The easy way for the functions_upload.php file would be if you were to upload the file as an attachment and I will upload the changes, or you can change the coding. Just find the following code below ( it is past the middle of the page )

    PHP Code:
    if ($flv_metadata != 'none' && $file_extn == 'flv'
    and replace the $file_extn == 'flv' with a non video extention like txt. It should look like this.

    PHP Code:
    if ($flv_metadata != 'none' && $file_extn == 'txt'
    Again I am using this code from vShare 2.8 so it may be better if you upload the video_conversion.php file. I hope this helps.

    ~zelda180~
    www.80TOONS.com
    I have a heavily modified version of vShare 2.8 beta WITH my own mobile addon at 80TOONS.com . Please let me know what you think.

    HOSTING WITH FULL vShare SUPPORT, my mobile addon support for vShare 2.8 & FFmpeg permanent video water marking at GIFTSnMORE.com . Thanks

  5. #5
    Join Date
    Dec 2010
    Posts
    22

    Smile

    The easy way for the functions_upload.php file would be if you were to upload the file as an attachment and I will upload the changes, or you can change the coding. Just find the following code below ( it is past the middle of the page )
    Thank you very much @zelda180

    background transparency must be the same size as the converted videos EG. 320x240 --> My Player setting is 600x500 --> But i have made a watermark 300x240 !

    Every thing went smooth, except i couldn't find the above said code in my functions_upload.php as I'm using vShare 2.7

    I have uploaded the required file for version 2.7.

    Thanks again.
    Last edited by vetty; 12-22-2010 at 07:45 PM.

  6. #6
    Join Date
    Sep 2008
    Posts
    1,019

    Default

    Just a couple of notes:

    Quote Originally Posted by zelda180
    Great your FFmpeg version is the same as mine so far we are on the right page. Lets start with the first question...
    ffmpeg and ffmpeg-php do not necessarily follow the same version numbers. Most hosts install ffmpeg from SVN which does not have a version number at all. Generally speaking, if your ffmpeg was built after 2008, it does not have vhook.

    Quote Originally Posted by zelda180
    I personal use menplayer because some say it gives better results.
    This used to be true for a few file types (specifically WMV and FLV files). However, this is no longer the case. I would argue that ffmpeg actually gives you better still thumbs than does mencoder. Today, the only real thing that mencoder has over ffmpeg is speed (mencoder can generate files faster than ffmpeg). But, with that speed comes considerable quality loss, which is why I prefer to use ffmpeg for all conversions altogether.
    vShare Solutions
    Custom vShare Modules and Services

    Now, your visitors can watch videos on your site using their mobile or tablet device with the Mobility Mod for vShare 2.8!

  7. #7
    Join Date
    Feb 2011
    Posts
    1

    Default Tutorial didn't work for me - help!

    Hi,

    I followed all your STEP BY STEP TUTORIAL FOR FFMPEG WATERMARK AND IT DOESN'T WORK. Here is the code:

    <?php

    $cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";

    # For old version of mplayer
    # $cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:l ast_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_fram es";

    # For latest version of mplayer
    $cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:l ast_pred=3 -srate 22050 -ofps 24 -vf harddup";

    $cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";


    //ffmpegflv - ffmpeg codec 11-2-10 converts to .flv With Watermark
    $cmd_ffmpegflv = "$config[ffmpeg] -i '$video_src' -s 320x240 -f flv -b 900k -acodec libfaac -ab 16k -vf 'movie=0:png:/home/zamundat/public_html/include/settings/watermark_flvideo.png [wm];[in][wm] overlay=1:0:0 [out]' $video_flv > /home/zamundat/public_html/include/settings/flvid.log 2>&1 ";

    $cmd_all = $cmd_ffmpegflv;

    $convert_3gp = $cmd_all;
    $convert_mp4 = $cmd_all;
    $convert_mov = $cmd_all;
    $convert_asf = $cmd_all;
    $convert_mpg = $cmd_all;
    $convert_avi = $cmd_all;
    $convert_mpeg = $cmd_all;
    $convert_wmv = $cmd_all;
    $convert_rm = $cmd_all;
    $convert_dat = $cmd_all;
    $convert_f4v = $cmd_all;

    CODE END -------------

    Can you please tell me what's wrong. Help!

    Thanks

  8. #8
    Join Date
    Jan 2009
    Location
    United States of America
    Posts
    45

    Default

    Quote Originally Posted by backowall View Post
    Hi,

    I followed all your STEP BY STEP TUTORIAL FOR FFMPEG WATERMARK AND IT DOESN'T WORK. Here is the code:

    <?php

    $cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";

    # For old version of mplayer
    # $cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:l ast_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_fram es";

    # For latest version of mplayer
    $cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:l ast_pred=3 -srate 22050 -ofps 24 -vf harddup";

    $cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";


    //ffmpegflv - ffmpeg codec 11-2-10 converts to .flv With Watermark
    $cmd_ffmpegflv = "$config[ffmpeg] -i '$video_src' -s 320x240 -f flv -b 900k -acodec libfaac -ab 16k -vf 'movie=0:png:/home/zamundat/public_html/include/settings/watermark_flvideo.png [wm];[in][wm] overlay=1:0:0 [out]' $video_flv > /home/zamundat/public_html/include/settings/flvid.log 2>&1 ";

    $cmd_all = $cmd_ffmpegflv;

    $convert_3gp = $cmd_all;
    $convert_mp4 = $cmd_all;
    $convert_mov = $cmd_all;
    $convert_asf = $cmd_all;
    $convert_mpg = $cmd_all;
    $convert_avi = $cmd_all;
    $convert_mpeg = $cmd_all;
    $convert_wmv = $cmd_all;
    $convert_rm = $cmd_all;
    $convert_dat = $cmd_all;
    $convert_f4v = $cmd_all;

    CODE END -------------

    Can you please tell me what's wrong. Help!

    Thanks


    I have the same problem it doesn't work

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •