It has always been that with ffmpeg, if you want to watermark a video, you needed vhook. vhook as we all know is old and not very useful to windows users and in the newer ffmpeg builds has been replaced with video filters, or –vf.
One of the filters in the new –vf format is a watermark filter, allowing you to watermark your videos during the transcoding procedure.
An example would be: –vf “overlay:10:10” which would tell the overlay to position 10 pixels from the top of the main video, and 10 pixels from the left.
But what if we want to position from the right? Or from the bottom? Or centre the overlay? This is where main_w (main video width), main_h (main video height), overlay_w (overlay video width) and overlay_h (overlay video height) comes in. You can use these variables to represent the certain set sizes of the video and the overlay.
So what if we wanted to position 10 pixels from the right and 10 pixels from the bottom? We would the use: –vf “overlay:main_w-overlay_w-10:main_h-overlay_h-10”.
So how do we specify the overlay? What we do is use the “movie” video filter which would take our png or jpg and convert that into a movie which is then overlaid on top of our existing movie.
See example below:
ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv
Or if you are planing to use your video with a newer version of flash that supports h264 encoded videos, you could use:
ffmpeg.exe -i input.avi -sameq -vcodec libx264 -acodec libfaac -vf "movie=logo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w)/2:main_h-overlay_h-10 [out]" -threads 0 "output-slow.mp4"
qt-faststart.exe output-slow.mp4 output-fast.mp4
Thus giving you a watermarked MPEG4 h264 + AAC file capable of streaming with a flash player.
I wanted to search and replace every file in a directory tree and find a URL that linked to /web-design and remove that part of the URL, and i also wanted to find the phrase “Web Design” in a link and replace it with “Affordable Web Design”.
Usually i would have to go through each individual file via SSH or FTP and then open the file, make the edits, save the file and re-upload the file. The problem with that is, i needed to do this for over 15,000 files on over 3000 web sites, and that isn’t something i wanted to do.
Firstly, i needed to find all the html files that could possibly have these two defects, so i went with “find”, its simple, and easy, and crawls sub directories as default.
Find all files with the extension “.html” in the current directory and all sub directories:
find . -iname '*.html'
The problem i had then was, web sites that are still being worked on are in a private directory that i do not want to alter, so i needed to exclude these directories:
find . -iname '*.html' -not -path '*private*'
This now gives me a list of everything that i need to do a search and replace on.
For this next part, you can use either “sed” or “perl”. I chose to go with perl as i know perl better than sed.
This cold should replace “/web-design” with “” in a file called “index.html” in the current folder. (Follows the format “s/what to find/what to replace with/g”):
perl -pi -w -e 's/\/web-design//g;' index.html
So what we need to do now is use xargs to combine the two parts and make the search and replace in all files:
find . -iname '*.html' -not -path '*private*' | xargs perl -pi -w -e 's/\/web-design//g;' -sl
This code should now look in the current directory, and all sub-directories contained within for any html file not in a private folder, and remove the text “/web-design” and replace it with nothing.
The next bit was a simple modification to replace the phrase “Web Design” with “Affordable Web Design”, though we needed to take into account that we only wanted to replace content within a A HREF tag, so we need to search for “>Web Design<”
find . -iname '*.html' -not -path '*private*' | xargs perl -pi -w -e 's/\>Web Design\</\>Affordable Web Design\</g;' -sl
Make sure that when you are creating your regular expressions, you escape any special characters such as \ / < > and friends.
I am sorry to say that my hosting provider did not like me using the dedicated host i paid for, so that i could run build processes on the server, running build processes on the server.
They killed my entire build environment, and all the builds.
Until i am able to find a new host that is willing to let me create these builds, the ffmpeg builds will remain down.
Anyone looking to get ffmpeg builds for windows for now should look at http://ffmpeg.zeranoe.com/
Sorry, and thank you to everyone who used my builds.
I initially ran into quite a lot of difficulty building libvpx (webm) for windows (win32) under msys or linux using mingw32, but I eventually cracked it.
git clone git://review.webmproject.org/libvpx.git
cd libvpx
CROSS=i686-pc-mingw32- ./configure --prefix=/usr/i686-pc-mingw32/mingw --target=x86-win32-gcc
make
make install
The only thing you would generally need to change is the “i686-pc-mingw32″ generally needs to be changed to reflect the mingw in your build system and the prefix needs to point to your mingw toolset root. Not only will this create a working library to use within windows projects (the libvpx.a can be added to visual studio projects), it creates and installs a library that builds perfectly into ffmpeg win32 builds.
Simple, no patches required.
Most HD is distributed in either WMV-HD or mkv x264. WMV-HD plays by default on the Xbox360 but mkv’s do not and transcoding 1080p can take a long time.
The thing is, you dont need to transcode the entire file, usually just the audio (360 cant play AC3 from within a mp4 container). The x264 that exists within the mkv works perfectly on an Xbox 360 and it takes nothing more than copying the video from one container to another, and re-code the audio.
You simply need:
ffmpeg -i input.mkv -vcodec copy -acodec aac -ab 192k -ac 2 -threads 0 -strict experimental output.mp4
Depending on your version of ffmpeg, you need to replace aac with libfaac.
You can also create a batch script that converts an entire directory of mkv’s to mp4′s for you.
FOR /R “in” %%D in (*.mkv) DO ffmpeg -i “%%D” -vcodec copy -acodec libfaac -ab 192k -ac 2 -threads 0 -strict experimental “out\%%~nD.mp4″
Create a text file called convert-mkv-mp4.bat and paste this line inside, when you run it the script will look inside a directory “in” and outputs the mp4′s in a directory called “out”. You will need to create the two directories yourself before running the script or errors will ensue
If you need recent win32 ffmpeg builds, you need to check my ffmpeg win32 autobuilds page.
Import.XMLCSV is a basic simple, and usable XML, CSV and vCard reader
CSV Usage:
CSVImport m_csv = new CSVImport();
m_csv.Load("thecsvfile.txt");
CSVRow m_row = m_csv.GetRow(1); //get the first row
XML Usage:
XMLImport m_xml = new XMLImport();
XMLNode m_root_node = m_xml.LoadXML("xmlfile.xml");
/* you can now use m_root_node and traverse your way down to all the child nodes */
Includes Visual Studio 2008 project file, but works all the way back to .NET 2.0 and all the way up to .NET 4.0
Download Import.XMLCSV
Secure passwords are random strings of letters (both upper case and lower case), numbers, and special symbols. Rather than simply using a dictionary word.
All passwords should be stored as a hash, so that nobody with access to the database they are stored in can simply see all the plain text passwords.
The advantage is that a totally random password can only be broken by a brute force method, which means a program has to generate random strings and create the hash for that string, and compare it to what is in the database. Once it finds something that matches, that is the password.
On a powerful computer, a well written program can run through around 17 billion different generations, hashes and checks per hour. (2 * (2^33))
The longer the password is, the longer it takes to crack the password via the brute force method. See below for examples.
Upper or Lower Case Only
| No. Characters |
1 Compter |
100 Computers |
1,000 Computers (small botnet) |
| 8 |
6.08 hours |
0.06 hours |
0.006 hours |
| 10 |
4,108.5 hours |
41.085 hours |
4.1084 hours |
| 12 |
2,777,348.18 hours |
27,773.48 hours |
2,777.35 hours |
Mixed Case and Numbers
| No. Characters |
1 Compter |
100 Computers |
1,000 Computers (small botnet) |
| 8 |
6,354.53 hours |
63.55 hours |
6.35 hours |
| 10 |
24,426,826.45 hours |
244,268.26 hours |
24,426.83 hours |
| 12 |
93,896,720,861.02 hours |
938,967,208.61 hours |
93,896,720.86 hours |
Mixed Case, Numbers and Special Symbols
| No. Characters |
1 Compter |
1,000 Computers |
100,000 Computers |
| 8 |
177,407.91 hours |
177.41 hours |
1.77 hours |
| 10 |
1,567,576,296.21 hours |
1,567,576.30 hours |
15,675.76 hours |
| 12 |
13,851,104,153,269.40 hours |
13,851,104,153.27 hours |
138,511,041.53 hours |
As you can see, not only is the character space (upper case/lower
case/numbers/symbols) important, but also string length. e.g. an 8 character,
totally random string using mixed case, numbers and symbols could be cracked in
less than two hours on a larger botnet, and it is likely that the person
stealing this information has access to something like this, but for a 12
character string, this would take over 15,800 years on a 100,000 computer
botnet.
p.s. A 32 character mixed case, numbers and sybol password would take upto
45,839,513,591,436,800,000,000,000,000,000,000,000,000 years on 100,000,000 (100 million) computers,
to brute force which is one-million-trillion-trillion times longer than the universe has existed.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R=301]
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://%{HTTP_HOST}/ [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.htm
RewriteRule ^(.*)index.htm$ http://%{HTTP_HOST}/ [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index.html
RewriteRule ^(.*)index.html$ http://%{HTTP_HOST}/ [R=301,L]
this little strip of code will make sure you always have a WWW and will make sure that you dont have / and index as two seperate pages.
When you have large scale websites that span many servers, sometimes servers go down, and you get a missing image, even if the server is up, you can get corruption loading to a broken image that does not display correctly. This piece of javascript aims to fix broken images on each page load, giving an overall more profesional look. Quite simply, the javascript adds a hook into each image and checks to see if the image has loaded properly or not, and if not, a replacment images is put there instead to make sure that the missing image is auto-fixed for you and the site does not have any missing images.
step 1. add this piece of code as the very last thing before the body close tag within a <script> tag
var i = 0;
var img = new Image();
for (i = 0; i < document.images.length; i++) {
img = document.images[i];
img.onerror = function (evt) {
this.src = "soon.gif";
}
};
step 2. “soon.gif” image and drop it within the same directory as the file that is using the script (i.e. the root web directory)
now you will notice that when you have missing images within the site, they will now be replaced by “soon.gif”.
Notes. you can put the replacement image within a directory and use any filename you wish as long as you reflect the changes within the javascript.
If you want to automate the way in which you submit your new websites to the major search engines, try using the sitemap.xml pinging service. You just replace [FULL SITEMAP URL] with a URL encoded version of the full URL of your sitemap and then GET request each ping service.
http://www.google.com/webmasters/tools/ping?sitemap=[FULL SITEMAP URL]
http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=[FULL SITEMAP URL]
http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=[FULL SITEMAP URL]
http://submissions.ask.com/ping?sitemap=[FULL SITEMAP URL]
http://www.bing.com/webmaster/ping.aspx?siteMap=[FULL SITEMAP URL]
http://api.moreover.com/ping?u=[FULL SITEMAP URL]
Older posts >>