Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Need Step By Step Tutorial For FFMPEG Hardcoded Watermark

  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
    May 2009
    Location
    On Earth
    Posts
    15

    Talking New functions_upload.php file to convert .flv files

    I would like to first thank bplex for your input, a lot of your previous posts has helped me out when I was having trouble with this script. So thanks again.

    As for the functions_upload.php file. I have uploaded the new file and I did test it and it converted the .flv file with the watermark with no issues. I have delete the code below

    **REMEMBER TO BACKUP YOUR FILES**

    Code:
            
            if ($file_extn == 'flv' || $file_extn == 'mp4')
            {
                $log_text = "<h2>MOVING UPLOADED FLV: $video_src => $video_flv</h2>";
                write_log($log_text, $log_file_name, $debug, 'html');
                
                if (! copy($video_src, $video_flv))
                {
                    $log_text = 'ERROR: moving uploaded file failed';
                    write_log($log_text, $log_file_name, $debug, 'html');
                }
                
                if ($file_extn == 'flv')
                {
                    if (get_config('enable_flvtool') == 1)
                    {
                        $cmd_flvtool = $config['flvtool'] . ' -U ' . $video_flv;
                        $tmp = exec($cmd_flvtool, $exec_result);
                        $log_text = "<h2>Running flvtool2: $cmd_flvtool</h2>";
                        write_log($log_text, $log_file_name, $debug, 'html');
                    }
                }
            }
            else
    This tells vshare to skip the encoding process for .flv files and only insert the meta data in to the .flv file. Now vShare wil convert all .flv files and add the watermark to all uploaded videos.

    Please let me know if this did or did not work. Thanks
    Last edited by zelda180; 12-23-2010 at 08:56 PM. Reason: Removed Attached File
    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

  8. #8
    Join Date
    Dec 2010
    Posts
    22

    Default

    Thank you zelda180,

    I have uploaded the file and made the necessary changes.

    PHP Code:
    /home/YOUR_USERNAME/public_html/include/settings/flvid.log 2>&"; 
    I don't have a file named flvid.log include settings.
    The only files inside are upload.php, video_conversion.php and watermark_flvideo.png
    I have changed YOUR_USERNAME in TWO instances of the code given (ie., cpanel username)

    After uploading a video, It said uploaded successfully.
    Previously it used to give a message as:



    This time it was different:- It gave as, pl refer image.

    Below is the result:




    Admin Panel:



    Edit Video:


    Uploaded videos was not published on the site.Where i went wrong ???
    Last edited by vetty; 12-22-2010 at 09:06 PM.

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

    Question Hmmmmm

    It sounds like there is something wrong with your video_conversion.php file. That is also why you recived the "uploaded successfully" message. Can you copy and past the /include/settings/video_conversion.php code or upload the file so that I can check.

    Also....

    1. What dose the status say in your Process Queue in your admin panel?

    2. Did you add the code below at the end of your video_conversion.php file?

    Code:
    $convert_flv = $cmd_all;

    3. The
    /include/settings/flvid.log file is a more detail conversion log that is created during the video conversion and for some reason it is not being created.


    This is my video_conversion.php file code

    Code:
    <?php
    
    //ffmpegflv - ffmpeg codec 11-2-10 converts to .flv With Watermark
    $cmd_ffmpegflv = "$config[ffmpeg] -i '$video_src' -s 320x240 -f flv -b 600k -acodec libfaac -ab 16k -vf 'movie=0:png:/home/YOUR CPANEL NAME/public_html/include/settings/watermark_flvideo.png [wm];[in][wm] overlay=1:0:0 [out]' $video_flv > /home/YOUR CPANEL NAME/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_flv = $cmd_all;
    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

  10. #10
    Join Date
    Dec 2010
    Posts
    22

    Default

    Sure i will do it right away.

Page 1 of 2 12 LastLast

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
  •