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:
Quote:
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.
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
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
You need to enable the Movie filter
It looks like you need to enable the movie filter in your FFmpeg, that would require ROOT access to the server to recomply FFmpeg. If you are on a shared host you must ask your hosing company to enable the movie filter in your FFmpeg. If you have a VPS you can use Google to find how to enable the movie filter in FFmpeg. I have found a link below that may help you out.
http://ffmpeg.arrozcru.org/forum/vie...0&p=4889#p4867
This is how my FFmpeg is set up
Code:
enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdc1394 --enable-libfaac --enable-libmp3lame --enable-libopenjpeg --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --enable-avfilter
libavutil 50.32. 3 / 50.32. 3
libavcore 0. 9. 1 / 0. 9. 1
libavcodec 52.92. 0 / 52.92. 0
libavformat 52.83. 0 / 52.83. 0
libavdevice 52. 2. 2 / 52. 2. 2
libavfilter 1.53. 0 / 1.53. 0
libswscale 0.12. 0 / 0.12. 0
[flv @ 0x10980470] Estimating duration from bitrate, this may be inaccurate
If this sounds "Greek" to you, you are welcome to host your site at GIFTSnMORE.com (that's my hosting site). I have also uploaded the edited files for you to upload when the FFmpeg is ready.
Don't forget to change "YOUR CPANEL NAME" to your user name.
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