Jameser's Tech Tips

Thursday, June 29, 2006

Tip #3: Creating Flash Video with Free Tools

Today's tip is a start-to-finish how-to on creating Flash video for displaying embedded video on your website... Using freely available tools, you can create videos for your site that will be viewable by anyone who has a Flash enabled browser (which is just about everyone)...

First, let's run through the tools we'll need to complete this...
1. Mencoder - Part of the MPlayer package... Select a mirror under "Windows releases"...
2. FLVMDI - FLV Metadata Injector... For injecting metadata into our video so Flash will play it...
3. The SWF files to embed in your web page:
FLVPlayer_Progressive.swf (right click and SaveAs)
clearSkin_3.swf (right click and SaveAs)
And finally, we'll need a source video to work with... I'm going to demo with a short clip from archive.org...

Step 1: Convert Your Video to FLV (Flash Video)
Download and install MPlayer/Mencoder... Next, open a command prompt (Start/Run/cmd) and change directories to where you installed it...
cd \Program Files\MPlayer

Now use the following line to convert an existing file to the FLV format:
mencoder "infile.avi" -o "outfile.flv" -of lavf -oac mp3lame -lameopts br=32 -af lavcresample=22050 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=340:autoaspect:mbd=2:trell:v4mv -vf scale=320:240

That should be all on one line, and that is one long command... We'll go through it to highlight the important bits... The "infile.avi" should be replace with the path and name of the file you are trying to convert... The quotes are needed if the path has a space in it... The "outfile.flv" is the path and name of the output FLV file you are creating... The "-oac mp3lame" through the "-srate 22050" specify the codec to be used for audio compression, as well as the bitrate and sample rate of the audio to be created... The "-ovc lavc" through "...v4mv" specify the codec to use for video compression and bitrate, as well as some options for motion estimation... The final "-vf scale=320:240" says to rescale our video to be 320 by 240 resolution...

After you run this command on your source video, you will then have the FLV video file to embed in your web page... But it's not quite ready yet... It needs metadata added to it if you want the Flash Player to be able to play it...

Step 2: Add Metadata to Your FLV File
We need to do one more step to the FLV before we release it to the masses... We will add the FLV metadata to it using the FLV Metadata Injector... (see above under required tools...)

After you have downloaded and extracted FLVMDI, change to the directory you extracted it to and type the following:
flvmdi whateveryourfileiscalled.flv
That's it... flvmdi will add the necessary metadata and we'll be ready to go to the next step...

Step 3: Place the Necessary Files on Your Webserver
Okay, now you'll need to upload the FLV file you created, as well as the FLVPlayer_Progressive.swf and clearSkin_3.swf to your webserver... It is probably preferable to place all the files in a single directory for this example...

Step 4: Add the following block of code to the page you'd like to embed the video on...

<!-- Begin Flash Video for Progressive download -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#v..."
width="320" height="240" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars"
value="&skinName=clearSkin_3&streamName=yourfilename&autoPlay=false&autoRewind=false"
/>
<embed src="FLVPlayer_Progressive.swf"
flashvars="&skinName=clearSkin_3&streamName=yourfilename&autoPlay=false&autoRewind=false"
quality="high" scale="noscale" width="320" height="240" name="FLVPlayer"
salign="LT" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
<!-- End Flash Video for Progressive Download -->


The key things you'll need to change in this block are the two locations for width and height, and the two locations for the basename of your FLV file... The streamName should not inlcude the .flv extension... Also, make certain that the src and streamName point to the correct location if your html document is not in the same directory as your FLV and SWF files...

Step 5: Enjoy Your Video
If done correctly, your FLV video should now be viewable on your site... The example below shows the resulting video...




Please post in the comments if you have any ?'s...

Tip #2: Speeding Up Windows XP Boot Time

After a while of use, (weeks or months), your Windows XP install may seem to boot up a little more slowly than it did when it was new or freshly reloaded... The following 3-part tip will show you how to speed up your boot time, and get your machine back to it's faster booting old self...

Step 1: Cleaning the Registry
The first thing you should do is scan your registry for errors or references to files that are no longer there... After installing/uninstalling numerous applications, some may leave remnants behind in the registry and slow down your boot time...

As always, anytime you are doing anything with your registry, you should back it up... To back up your registry, simply click on Start/Run/regedit, and then select File/Export from the menu bar... Make certain that the "Export Range" at the bottom of the Export Registry File window is checked on "All", then select a filename to save your registry to... A good choice is the date you're backing it up, (i.e. 2006-06-29.reg)...

Once you have backed up your registry, you are now ready to clean it... The program that I use is EasyCleaner from ToniArts, as I have found it be the most reliable...



Assuming you have downloaded and installed EasyCleaner, launch the application and click on the Registry button in the upper left corner of the application, then click on the Find button... The application will now search your registry and display a list of all the errors it encountered... After it has completed scanning, click on the Delete All button to remove these entries from your registry...

Exit the application and reboot your machine... You should notice it booting slightly faster if you had numerous registry errors removed...


Step 2: Cleaning the Prefetch Directory
Windows XP uses a directory where it stores "prefetch" information for the executable files on your machine... These prefetch files help to speed up the launch time of individual applications.... The problem is that over time, the prefetch directory builds up entries for files which no longer exist, or which are infrequently used...

Removing the prefetch files is a simple task... Simply click on Start/Run then type "prefetch" and hit ENTER... This will display a listing of all the files in your prefetch directory...

To delete these files, simply select Edit/Select All from the menu bar, and then press the Delete key... Answer "Yes" to the "Are you sure..." prompt... (Make certain you are in the prefetch directory before doing this!!!)

Now reboot again...

Step 3: Defragmenting Boot Files
If the boot files for your machine become fragmented over time, it will affect the boot time... To defragment the boot files, perform the following steps:

Open a command prompt by clicking on Start/Run/cmd and pressing ENTER...

You can now defragment the boot files by using an undocumented switch for the defrag.exe application, as follows:
defrag -b c:
This command will defragment only the boot files on your PC, and should only take under a minute...

After the command completes, go ahead and reboot your machine one more time...

Summary:
Following these steps should help to decrease the amount of time it takes for your XP machine to boot up... Please ensure that you have your registry backed up prior to following these steps... And always back up your data...

Please leave comments if you have any ?'s...

Until next time...

Tuesday, June 27, 2006

Tip #1: Checking POP3 Mail via Telnet

This is tip #1 of what I hope to be many... I'll try to add at least one per day, so please check back frequently for new postings...

Scenario: You are not at your main PC and need to check your POP3 mail... Granted there are websites which allow you to check your POP3 account via your browser, but that's just kind of taking the easy way out, and you may not trust some random webserver with your POP3 password...

With this technique, you'll be able to check your mail from pretty much any internet connected PC...

First open a command prompt on a Windows box (Start/Run/cmd), or open a shell on your linux box...

Next step is to connect to your POP3 via telnet using the following command:
C:\> telnet pop.yourmailserver.com 110
It is important to not leave off the 110, otherwise you'll be connecting to the server's telnet port (which shouldn't be open anyway)...

Once connected, you'll receive a prompt similar to the following:
+OK
That's it... That's all it will say, "+OK"... If you don't get this response, perhaps you have the server name incorrect, or neglected to add the port 110 at the end of your command...

Okay, now that we're connected, we'll need to let the server know who we are, via the following command:
USER yourusername (then hit ENTER)
You should then be greeted again with the ambiguous "+OK" prompt...

Next, we need to authenticate with the server, using the following command:
PASS yourpassword (then hit ENTER)
You should again receive the "+OK" prompt... Notice that your password is visible through this method, so you may want to hit ENTER a few times so it scrolls off the top of you screen... (You'll get -ERR prompts if you do , but they should not affect this process...)

Okay, now you're connected to your mail server, so let's proceed to check our mail... The following commands allow you get information on the number of messages you have waiting, as well as retrieving all or part of each messages content...

First, let's see what we have waiting for us with the following command:
STAT (then hit ENTER)
This command will give you the statistics for your POP3 box... The format is:
+OK 33 245667
The +OK means the server acknowledged your request, the 33 is the number of your messages waiting on the server, and the 245667 is the total number of bytes for all of your messages...

LIST (then hit ENTER)
This command will list all of the messages waiting in your account, and also display the size of the message. Example output:
+OK
1 2344
2 4567
The first number is the number of the message, and the last number is the size of the message...

Now let's take a look at one of our e-mails...
TOP 1 5 (then hit ENTER)
This command tells the server to display the first 5 lines of message #1... The header for the message will also be displayed so you can determine its origin...

Now, let's say we want to read the entire message for message #1... Use the following command:
RETR 1 (then hit ENTER)
The entire contents of message #1 will be displayed...

Okay, let's delete a message now... Use this command:
DELE 1 (then hit ENTER)
The message should now be deleted from the server...

Once you have checked your mail, you may now exit the POP3 session by issuing a QUIT command...
QUIT (then hit ENTER)
This should drop you back to your command prompt...

These are basically the same your steps any mail client uses to access, display, and retrieve mail from a POP3 server, and now you should be able to achieve the same results from any machine and any location...

Please leave comments if you have any ?'s...