Hardcoded video watermark mod
Ok so if you want your FLV files to have a watermark hardcoded onto them then this guide should help you. You might want this feature if you offer FLV files for download ( http://forums.buyscripts.in/viewtopic.php?t=1438 ) and want to keep your site URL on the video or if you want to make sure no one is removing the watermark from the embeded code.
You have 2 choices depending on what you use to convert you videos. I use mencoder as it seems to have better quaility results and is default converter on vshare, however if you use ffmpeg you have a better option.
ffmepg
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.
mencoder
If you use mencoder for converting it has a feature that is supposed to add image watermarks called bmov, however from my research it doesn't work great and no one knows how to use it. So for mencoder i just used the subtitler feature which lets me have a text watermark pop up with my site URL when i want and for how long i want.
Here is how to do it, first of all you need to create your watermark text file (subs file).
just open up a text editor and paste this into it.
Code:
1
00:00:05,000 --> 00:00:20,000
mysite.com
the code above will after 5 seconds of watching the video display "mysite.com" on the video for 15 seconds and then disapear. Edit it to display how you want, more info can be found here http://en.wikipedia.org/wiki/.srt
save the text file as watermark.srt and upload it to your include/settings/ directory.
Then open up include/settings/video_conversion.php with a text editor.
change the mencoder line so it looks like this
Code:
$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:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -sub /home/USER/public_html/include/settings/watermark.srt -subpos 98";
Remember to change the /home/USER/public_html to your path to vshare.
The -subpos 98 bit puts the watermark 98% down from the top of the video....so it would be right at the bottom....you could change it to -subpos 2 if you wanted the watermark at the top of the video.
And thats it....when your video is converted you should have a hardcoded text watermark on your video :)
You should also be able to change the font, size, colour, width position etc but i have not had time to look into that yet.
Re: Hardcoded video watermark mod
This works great Leki, Thanks. I really think this should be incorporated into the next release.
Is there a way to apply the watermark to videos already converted? I'm up to nearly 2000 vids so it would be useful if I could set this up as some sort of cron job.
Secondly how can you affect the horizontal position of the watermark?
Re: Hardcoded video watermark mod
glad you like it, to get it into your already converted videos they would have to be converted again.
i didn't find any command to change the horizontal position from my initial looks but i think there are more advanced ways to subtile videos which may be able to do it....i dont have time to look into them myself right now though.
Re: Hardcoded video watermark mod
Ok np I quite like it in the middle now though .. got used to it.
Sorry for being a dummy but how do I go about reconverting the videos? I dont have them in the process queue anymore and I've been searching this forum for tips.
Re: Hardcoded video watermark mod
@SportsGamingTV.com
if your mencoder is old it may also not support subtitles, best to run the command manually from SSH to see what error you get.
i posted how you can get vshare to reconvert FLV files in another thread....so could work with flv files if needed.
Re: Hardcoded video watermark mod
Maybe that's the problem. I do not even know what version I'm running, to be honest. I'll give this another look tomorrow and see if I can straighten it out.
Re: Hardcoded video watermark mod
Quote:
Could you give me a link to that post. I can't find it when I search.
Thanks, Jereme
i meant for when an FLV is uploaded for it to be converted again....not reconverting all old flv files in one go.....for that i guess u would have to write a script or something
viewtopic.php?f=8&t=2298
Re: Hardcoded video watermark mod
well using the "import" feature most likely bypasses all converting....but uploading as a user with that fix works acording to the other guy in the thread....does your mencoder apply the watermark to other videos?
Re: Hardcoded video watermark mod
does the FLV convert with the watermark if you run the command manually from SSH?
could post your the whole of your video_conversion.php file and ill see if i can see anything wrong.
Re: Hardcoded video watermark mod
@mhancoc7
you can check your debug.txt file for the command and you will need ssh access to your site....check with your host if you have it.
Re: Hardcoded video watermark mod
I found this watermark is no longer working on my site, it stopped working about 7 days ago, I upgraded to 2.6 over a month ago so that can't be the problem. Here's the code that I use that no longer works... any ideas?
Code:
1
00:00:00,000 --> 00:04:00,000
boxspots.com
Code:
<?php
$cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -ar 22050 -ab 32 -f flv $video_flv";
$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:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -sub /home/boxspots/public_html/include/settings/watermark.srt -subpos 98";
$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:last_pred=3 -srate 22050 -ofps 24 -vf harddup";
$cmd_all = $cmd_mencoder;
$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;
Re: Hardcoded video watermark mod
I can hardly wait to try out this mod...as soon as my host gets my video_conversion working, I'm going to give this a whirl.
Re: Hardcoded video watermark mod
Dang, this thing rocks! Wish I had known about it from the beginning so I can get rid of the watermark.gif thingie LOL but for future uploads, they're all getting hardcoded, I don't care! :P
I think, in the meantime, I'll download all the existing .flv's, convert them with this command on my harddrive using ffmpeg.exe and re-upload and see what happens. (to do this you get ffmpeg.exe and put it in your c:\users\yourusername , then run it from command prompt (start >run > cmd.exe) and then type dir and hit enter so it displays the directory contents and then type ffmpeg.exe -i nameofvideo.flv and then whatever commands after that like -ar 22050 and all that junk and then the name of the output file at the end like nameofvideo.avi or nameof video.flv or whatever... if you google this you'll find it probably in some wiki thing somewhere---just put the video you want to monkey with in the same dir as your ffmpeg.exe). How this works locally for mencoder, I'll be googling that too.
I'm also going to be checking out how to do the fonts and stuff. Thank you so much for sharing this!!!
@ROB: in the line that says
Code:
$cmd_ffmpeg = "$config[ffmpeg] -i $video_src -acodec mp3 -ar 22050 -ab 32 -f flv $video_flv";
I think you need to have single quotes around the $video part so that it looks like this and also note the libmp3lame instead of mp3:
Code:
$cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";
As always, rename your original files so you can revert back to it if things shouldn't work out like you expect.
Re: Hardcoded video watermark mod
I found this about how to change the color and the font.
http://wiki.showmedo.com/index.php/Video_editing_Ubuntu
Go down to the section that says "merge video with subtitles"
Haven't tried it yet, but plan to.
Re: Hardcoded video watermark mod
Not working for me, here is my original file, any idea on how to modify it?
It seem I'm using the new version of mencoder but my command is slightly different to the one modified with -sub here...
At the end you can notice the difference between -lavfopts and -ofps.
Code:
<?php
$cmd_ffmpeg = "$config[ffmpeg] -i '$video_src' -acodec libmp3lame -ar 22050 -ab 32 -f flv $video_flv";
// For rpm (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:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames";
// For latest svn 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:last_pred=3 -srate 22050 -ofps 24 -vf harddup";
$cmd_all = $cmd_mencoder;
$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;
Re: Hardcoded video watermark mod
How your mendcoder converts shouldn't matter, I wouldn't think. Check the wiki links posted so that you can learn more about how this stuff works. Basically what this is doing is putting a "Subtitle" into your videos when you convert them. It'll be just like the subtitles that appear in movies when it's spoken in one language but needs to be understood by people of another language, the translation appears as a subtitle at the bottom of the movie. This is the -sub command.
All you have to do is add the -sub command to the end of the mencoder commands:
Code:
-sub /home/USER/public_html/include/settings/watermark.srt -subpos 98
The last command, -subpos , is the subtitle position. Changing that number will change where the subtitle appears. 98 makes it appear very close to the bottom of the video. 2 would make it appear just below the top, for example.
So, if you simply add the subtitle command to the rest of your mendcoder commands, your video_conversion.php should look like this:
Code:
$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:last_pred=3 -srate 22050 -ofps 24 -vf harddup -sub /home/USER/public_html/VIDEOSITE/include/settings/watermark.srt -subpos 98";
Make sure to change /home/USER/public_html/VIDEOSITE/include/settings/watermark.srt to the path to your files! If you don't know what that is, please consult your webhost.
Then put the watermark.srt (example provided by OP) that you created into the include/settings/ where the video_conversion.php is located.
Re: Hardcoded video watermark mod
Thank you grynmoors I tried but it wont works :(
Re: Hardcoded video watermark mod
Well, maybe there's something in one of the wiki articles cited that will help you? I don't know where it could be going wrong that it wouldn't work since it's just a mencoder command....so...IDK.
Send me your video_conversion.php and your watermark.srt so I can look at it. You have watarmark.srt in your includes/settings folder where the video_conversion.php is, yes?
Re: Hardcoded video watermark mod
I was trying to watermark some wmv to flv files. Surprisingly it works on some, but not on others. I use a software to convert powerpoint to wmv. These wmvs do get watermarked on upload, but others dont. any solutions ?
editing:
i found the problem. It has something to do with dimensions of the video. I was using 9 it did not show, i changed it to 15 and saw it partially. So i changed it to 90. and it looks cute at the bottom now.
Re: Hardcoded video watermark mod
has anyone had any luck hardcoding an IMAGE watermark in vShare yet?
Re: Hardcoded video watermark mod
is not working on mine:
Array
(
[0] => MEncoder dev-SVN-r25540-4.1.2 (C) 2000-2007 MPlayer Team
[1] => CPU: Intel(R) Core(TM)2 Duo CPU E6550 @ 2.33GHz (Family: 6, Model: 15, Stepping: 11)
[2] => CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
[3] => Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
[4] =>
[5] =>
[6] => Exiting... (error parsing command line)
)
################################################## ##
Return value: Exiting... (error parsing command line)
Video Conversion Finished
Re: Hardcoded video watermark mod
hello
I have done the whole thing to mine http://www.tubealotico.com
however it is not working
thank you
hardcode watermark for Version 2.8
I just added and tested this on my site 80TOONS.com today. I just added the -sub /home/YOUR USERNAME/public_html/include/settings/watermark.srt -subpos 99 command to the end of the mplayer codec. Here is my code it works with the latest mplayer version.
Code:
<?php
# 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:last_pred=3 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames";
# $cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -af resample=22050:0:0 -sws 9 -vf
# scale=448:-3,expand=448:336 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=500:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3 -oac mp3lame -lameopts abr:br=56:mode=3 harddup";
#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=$bit_rate:mbd=2:mv0:trell:v4mv:cbp:last_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";
//New Mplayer codec
$cmd_mencoder = "$config[mencoder] '$video_src' -o $video_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=1000:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050 -ofps 24 -vf harddup,hqdn3d=2:1:2,scale=640:464 -sub /home/YOUR USERNAME/public_html/include/settings/watermark.srt -subpos 99";
//Convert mp4 H264
$cmd_mp4_h264 = "$config[ffmpeg] -i '$video_src' -acodec libfaac -ab 96k -vcodec libx264 -vpre hq -crf 22 -threads 0 -b " . $bit_rate . "k $video_flv";
$cmd_all = $cmd_mencoder;
$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;
DON"T FORGET TO REPLACE THE /HOME/YOUR USERNAME/.... WITH YOUR USERNAME OR WITH THE CORRECT PATH TO THE WATERMARK.SRT FILE.
80TOONS.com