Updated Often.

Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Tuesday, August 12 gave rise to...

ffmpeg is pretty fucking cool.

FFmpeg is the Swiss Army Knife of command line tools for video and audio. It does many things you already want; for example, FFmpeg makes it easy to convert between almost any video or audio format you can think of. It also does some cool things you may not have considered trying before, like facilitating the usage of YouTube as a gigantic downloadable mp3 library. Also, considering that Flash video is the more or less the de facto official video format of the web (and thereby appears to be the future of video the web), FLV is a very important format to be able to convert from and to. FFmpeg makes this work incredibly easy.

Let's start this tutorial/guide with the mp3 stuff, then move on to more basic/intended usage, and then go on to something cool.

Extracting mp3 from YouTube videos (2 steps):

Let's say you like a song you heard on YouTube, but cannot find the mp3 anywhere online and there's nothing available at the record store. Back in the 1980s you would have been screwed -- you might have been upset enough to try a new drug called "crack" cocaine. But now with The Internet and FFmpeg, you can avoid becoming addicted to crack by downloading a DRM-free mp3 file that will play anywhere, directly from the YouTube video itself! Here's how:

  • First, download the video from YouTube. You can find the .flv file in the source code, but services like KeepVid have utilized YouTube's API to easily allow you to download the video directly from YouTube's server's in a higher quality .mp4 format.
  • Second, take the video, "video.mp4" and run it through FFmpeg like this:
    ffmpeg -i video.mp4 -ab 192k audio.mp3
    This will give you an mp3 with a fairly standard quality of 192kbps. You can make that value higher or lower if it pleases you, but remember your source: audio from a YouTube video. The saying, "You can't polish a turd," is true.

Extracting a clip from a longer video (1 step):

Let's say you really like a segment of a movie, and want to share it with the world. Here's how you can post it to YouTube using free software, make sure the audio syncs up with the video (often times it doesn't, if a certain option is not included in the command) and upload it faster than the dopes uploading video in mpeg or avi format:
ffmpeg -ss 00:06:09 -t 00:00:15 -i mmm.avi -async 1 -qscale 3.5 -vcodec flv seriously.flv
The first part of the command -ss 00:06:09 -t 00:00:15 means to start at 00:06:09 into the movie, and to play for 15 seconds. -i mmm.avi is where you tell FFmpeg to use mmm.avi as the input file. Yes, that's right -- you define the segment before you define the input file.

-async 1 is optional, but it is very helpful for a situation where the audio in your new cropped clip does not sync up with the video.

-qscale 3.5 is a variable command that changes the quality of your cropped clip. 3.5 is a good value here for YouTube -- it seems about equal to the quality of YouTube videos. A lower value means a higher quality. -sameq is a different option that serves the same function. It means to convert the video losslessly -- no loss in quality. Use sameq if you cannot tolerate any loss in quality from source to destination. When you're happy (or frustrated to the point of not being able to work any more) with the results, simply upload to YouTube.

If you want to convert a file from one format to another (losslessly), use this command:
ffmpeg -i input.mp4 -sameq output.mpg
Remember, the -sameq option means to use the same quality (lossless).

If you want to do something cool, like make a mux (or music video, if you prefer that term) a la Pink Floyd + The Wizard of Oz, try this:
ffmpeg -ss 00:04:25 -t 00:05:15 -i superman.avi -i grandma.mp3 -map 0:0 -map 1:0 -qscale 3.5 -vcodec flv killer.flv
When you want to make a simple video like what we're describing, this is a good way to do it. There are a couple of examples here.

The only option we haven't gone over yet here is -map. This is used in conjunction with the two input files to tell FFmpeg where to put them in the output. Here we have the first input file going to stream position 0 on output file 0 and the second input file is going to position 1. -map options correspond to the position in the command of input files -- so the first -map tells FFmpeg where to map the first input file specified in the command, the second tells where to map the second input file, and so on. It will make more sense if you try it. Use the format above if you get lost.

If you want to do something cooler, like this, where multiple video files are combined (see intro and outro), you will need to use another command line tool called cat. This tool concatenates files (it joins them together). It doesn't work with all video formats -- for instance, it will not work with .flv, but it will work with .avi. It also doesn't play nicely with certain differences between files, such as differences in video dimensions or bitrate. To really use this tool well you may need to consult the man page for ffmpeg or some mailing lists to see how other people solved their problems...but if you just need to join two files, here's how you do it:
cat mick.avi killar.avi > killar-milk.avi
And after this, you should run the resulting file killar-milk.avi through FFmpeg to rebuild the part of the file that tell video players their duration. If you don't, you probably won't be able to see the entire new video.

Hope this helps. Leave questions and comments in the comments area. Try combining these commands in new and novel ways to achieve interesting results. Really freak it. At the very least, post something online that has never been posted before; it's easy.

When you use the right tools, the Internet is your oyster.


FFmpeg is available for Linux, Mac, and Windows. Officially it's only available to be compiled from source, but you can use Google to easily find a build for your operating system. If you use Linux, check your favorite repository for your chosen distro -- it will be very surprising if FFmpeg isn't included.

Read Full Post »

Tuesday, July 29 gave rise to...

Guide Planned For Later This Week. Tentative Title: 'FFmpeg: The Silent Killer'. Also: Batman Comments Are Out Of Control.

My intent with this upcoming guide is to expose a techniques I use to easily do movie/music multiplexing on the command line. It will be similar to the popular animated gif guide.

In the meantime, read the 240 (and counting) comments on this post I made right after Heath Ledger died early this year. Also, note that for a variety of queries related to Heath Ledger's death and whether or not it was faked, that post is the top link on Google. Funny how much difference the release of a popular movie can make.

Remember the 'long tail'.

Read Full Post »

Wednesday, April 30 gave rise to...

Use GMail? Archive everything in your Inbox.

It runs noticeably faster that way.

Use labels and stars to manage your archived mail.

Read Full Post »

Monday, April 14 gave rise to...

Gmail Redesigned w/ Stylish for Firefox


I wish this existed for Google Reader.

  • Get Stylish Addon for Firefox here.
  • Install the Gmail Redesigned style, available here.

Gmail Redesigned, by Globex Designs

Read Full Post »

Tuesday, April 8 gave rise to...

Increase Max Results in Firefox 3 Location Bar


David Lanham: Somatic Icons

Firefox 3 will be out soon (the final beta is available now), and it has some cool new features. One of these is that you can search through previously visited pages (via page title or URL segment) from the URL bar just by typing. Another is that the drop-down URL bar is now sorted by how frequently you visit a specific page. The part of it that still sucks is that by default, it only gives you 12 results. That's too few. Hopefully in a later release they'll increase the default for this...

Until then, you can do it yourself.

Step 1:

Type
about:config
into the URL bar.

Step 2:

Type
browser.urlbar.maxRichresults
into the about:config filter (just below the URL bar).


Step 3:

Double click the result and change the value to 30.

Step 4:

Restart Firefox.

Read Full Post »

Friday, April 4 gave rise to...

Making Animated GIFs With Free Software in Four Steps

Note: apparently you do not need to use Linux to do this. There's a version of MPlayer that runs on Windows in the command line and The GIMP is also cross platform. Has anyone has success with this? I imagine all of the commands would be the same.

MPlayer is a pretty powerful tool for processing video files. It has a built-in command line option that will export specified movie frames to a GIF. Such a feature seems like it would make the guide I'm presenting here obsolete, but the problem with the feature is that the resultant GIF looks terrible: too few colors. As far as I've seen, the best way to get good quality animated GIFs using only free software involves using a combination of MPlayer's command line tools and a little bit of elbow grease in The GIMP. We will export the desired segment of video to a series of JPEG files, then use The GIMP to combine those files into a nicely animating GIF that should look nearly as good as the original video. I believe that it is possible to get MPlayer and The GIMP together in a script that will allow the end user to simply point the script to the desired movie file and the desired segment and the script will do all the "dirty work" and create the GIF. This is my end goal, but I have not taken the time necessary to learn any of GIMP's scripting language. If there is a pre-existing solution that allows one to do what I am trying to show here, I'd love to know about it, so please let me know.

Step 1 (for Debian or Ubuntu users):

sudo apt-get install gimp mplayer

Step 2:

mplayer -ao null -loop 0 -ss 0:11:22 -endpos 5 file.avi

This command will display the segment of file.avi on your screen that runs from 11:22 to five seconds later (11:27). It will loop infinitely until you close the window or send a ctrl+c to the terminal window. This command is useful for figuring out what your GIF will look like before you make it. The audio output will not be heard (is set to null)

Step 3:

mplayer -ao null -ss 0:11:22 -endpos 5 file.avi -vo jpeg:outdir=moviedirectory

This command actually creates the jpeg files you will need to make your animated gif. It is similar to the other command, but nothing is displayed on screen, and the command will not loop forever. The command will output the segment to a series of jpeg files in a directory called "moviedirectory".

Step 4:

Now that we have our directory full of jpegs, we should open the first of these files in The GIMP. Then, open the remainder of the images in the directory as layers (File -> Open As Layers). Every image in that directory should now be a layer. Now save the file as a .gif and choose to "save as animation" as opposed to "flatten image." Click export. Lastly, it is important to make sure "loop forever" is checked if you want a GIF that loops forever. The other options here can drastically change the effect of your gif because they change the speed that the gif is displayed at. A relatively fast gif will have a 15 millisecond delay between frames. The default delay of 100 ms is a bit slow in my opinion. Under frame disposal where unspecified I select "one frame per layer." I check "Use delay entered above for all frames" and "Use disposal entered above for all frames." Here are examples of the end result:





If you find that your image is too large, it is often helpful to resize it to be a bit smaller. This can help with the image's performance.

As Firefox is often the platform where people will be viewing your animated gif files, it is also a good tool to use to test them to see what the final product looks like.

If you found this post useful, share it. There are links to Digg, Reddit, del.icio.us, and other such sites at the bottom of the post. Thanks for reading!

Read Full Post »

Thursday, April 3 gave rise to...

Newsgroup Binaries with HellaNZB and LottaNZB faster than you can say "Cloverfield"

a howto article.

From nothing to downloading in about 5 minutes and that's with juice breaks. The file finished downloading in the amount of time it took me to put together this article. As an added bonus, HellaNZB will repair and extract your files for you, so you don't have to do any of that work -- your computer does it all for you, automatically.

LottaNZB is a clever and attractive frontend to HellaNZB.

"Why should I care about Usenet Binaries anyway?"

  • Because torrents can take forever to download and you often don't know what you're really downloading, or who is watching you download (these all apply pretty much specifically to non-private trackers). Usenet is the underbelly of the net (I have heard that the FBI uses fake child porn groups on Usenet routinely to set up sting operations on would be child predators) and it has been around forever.
  • A lot of stuff hits Usenet first -- many of the torrents you see contain files that originated on Usenet.
  • There's stuff on Usenet that you can't find on torrent sites

You will need:

  • Linux (pretty much any distro will do but Ubuntu or Debian will make it easy because of awesome/fairly simple package management)
  • An NNTP service provider -- check your ISP first; many ISPs have free NNTP service but with crappy redundancy (sometimes a week or less). I'm using Verizon with their crappy redundancy, but it is free. Paid newsgroup services are generally very reliable with very high rate of redundancy and speed for very low cost. If you don't have a paid newsgroup service you're severely limiting your chances of finding anything useful to download that is older than one week.
  • A little patience, the desire to get binaries for free.

How you do it:

  • sudo apt-get install hellanzb
  • sudo apt-get install python-elementtree python-glade2 python-gtk2
  • goto lottanzb website and follow build instructions
  • goto nzb search site such as binsearch and look for your file
Ok, tired of writing instructions. Hope this helps.

If using LottaNZB as a frontend, config file can be found at $HOME$/.lottanzb/hellanzb.conf
If just using hellanzb, config file can be found at $HOME$/.hellanzb/hellanzb.conf or /etc/hellanzb.conf.

*If you want this setup to automagically extract your rar files for you, go to the hellanzb.conf file -- open terminal, run command:
gedit .lottanzb/hellanzb.conf
and change
Hellanzb.SKIP_UNRAR = True
to
Hellanzb.SKIP_UNRAR = False
also change
Hellanzb.UNRAR_CMD = False
to
Hellanzb.UNRAR_CMD = "/usr/bin/unrar"

Read Full Post »

Thursday, March 20 gave rise to...

Tweaking Icons in Ubuntu Linux, Especially for use with Compiz and Avant Window Navigator

This is the sort of thing where the actual information is spread out across all four corners of the Internet and can rarely be found in one place cohesively. I aim to change that.


Insert some sort of meta-commentary about desktop aesthetics here
Gnome's Appearance Panel does a pretty good job of standardizing icons for a theme you select, but it doesn't get absolutely everything. Those little icons in the top left corner of the window, for instance. Or if you use Compiz or Avant Window Navigator (AWN), many of the icons pulled from the system for usage within those programs. AWN allows you to select custom icons, but those don't always "take" properly. Compiz does not give you this option at all. The result is the ruination of an otherwise seamless experience when you hit alt+tab by way of the wrong icons appearing in the application switcher. Maybe some will be small, and others will be twice as big. Some will be pixelated because they're stretched out; others are crystal clear. The purpose of this guide is to give you a little extra knowledge so that you might create for yourself a more seamless desktop experience. Eye candy certainly isn't everything, but it can make long sessions in front of the computer a lot more pleasant.

This guide should apply to Ubuntu 7.10 (Gutsy) and 8.04 (Hardy). It may work for other distros and other versions of Ubuntu. Alternatively, it may not work for any computer except my own. If that is the case, sorry!

Things you'll want:

  • nautilus-image-converter (apt-get this) -- this is great for resizing images straight from Nautilus without having to open up The GIMP.
  • a dash of paranoia + pack rat mentality so that you'll back up all icons you change -- who knows when you'll need those ugly backups, or what you might need them for...
  • the hard headedness to simply rename a .png file to .xpm and replace lots of xpm files this way -- because I don't know any better and couldn't tell you the difference between png and xpm. My desktop doesn't seem to notice the difference either.

The first step is relatively obvious: go to System > Preferences > Appearance, install your icon package by clicking the install button and locating the package, then select it by customizing the theme and selecting the icon package.

Now that this is taken care of, notice that some icons did not get customized. You'll have to do these yourself.

Common places to find icon files that are used by AWN/Compiz include:

  • Note that the following directories do not allow regular users to modify their contents by default. An easy way to change the file permissions here is to go to a parent directory such as /usr/share/icons (for the next bulleted item below) and running the command 'sudo chmod -R o+w /usr/share/icons/'. This command allows users other than the owner (root) to write to /usr/share/icons/ and all files and folders within that folder because of the recursive flag (-R).
  • Most programs can be found in '/usr/share/icons/hicolor/48x48'. Icons within the other size-based folders in 'hicolor' may also be of interest to achieve best effects.
  • Firefox icons are different. Perhaps due to it being such a cross platform program, it places them in a different location. You can find them in and around /usr/lib/firefox/icons and /usr/lib/firefox/chrome/default/icons.
The method you want to follow to replace these icons is to back up the icons that look like the ones you want to replace, then copy/resize/rename the icon you want as the icon you're replacing. It's hacky but you should be able to get it to work.
Note: I have not yet found the location of the OpenOffice pixmap files that would need to be modified to make this seamless for those icons as well.

Read Full Post »

Tuesday, December 4 gave rise to...

OS X Leopard on your (relatively) old AMD Machine

My computer is:


AMD 3000+ processor
NVidia GeForce 6600GT graphics card
MSI Nforce 4 motherboard
1024mb ram

ok so:

  • get Zephyroth's Leopard 10.5.1 for AMD disc image. burn to dvd.
  • make a new primary partition on your hard drive with at least 7 gigabytes of space on it
  • use gparted to format this partition as fat32
  • boot zephyroth's installer disc, use the disk utility (under the utilities menu at the top) to format/erase your new fat32 partition as an extended apple file system with journaling
  • install os x onto this partition, and be sure to install the nvidia drivers included; even though they're not for your specific video card, they will work. if your install appears to hang at "approximately one minute left" like mine did, let it go for about 15 minutes just to be safe and then restart. it should work.
  • edit your grub menu.lst file to include this new partition
  • if you're using a usb keyboard and mouse, you're fine. if you're using ps/2 keyboard/mouse, you're probably in a weird place, like me. i might edit this later with instructions on how to fix this, if i can get it working for myself. this will probably involve login hooks (basically shell scripts executed at login) and someone's hacked ps/2 drivers which, for some reason are not included in zephyroth's install as far as i can tell. that's right -- the image does not appear to have any sort of support for ps/2 inputs, which is weird, because the regular image does. either he was trying to save space or i've had two very unlucky installs.

Read Full Post »

Saturday, November 4 gave rise to...

Why I Migrated From Del.icio.us to Google Bookmarks.

I've supported Del.icio.us since I knew of it. It's been over three years. Recently, while reading lifehacker, I found out about a program for Mac called dead.icious. It's function is to help the user go through their delicious bookmarks and find the ones that are dead, or broken. I've been gathering bookmarks on delicious for a while now. When I first started, I was pretty excited about the whole "social bookmarking" thing, and it was the first site where I had seen tags used. Tags have since become huge in software for the web. Long story short, I was adding many, many new links to my bookmark library. Later, Useff introduced me to a Firefox extention called Foxylicious which would import my bookmarks from delicious into a regular bookmark folder in Firefox, which gives the effect of localizing all of one's delicious bookmarks so that they can be used at any given time. At this point, my use of delicious wasn't just to find new stuff - I depended on it as my bookmarks folder. It was convenient because this way, I could access my bookmarks from anywhere I wanted to.

Let's get a little closer to the present date and time; specifically, yesterday. I saw that program called dead.icious and decided to look into writing a similar program for linux, since it was Mac only. I started fooling around with the delicious API and doing some routine web searches to learn about how others had utilized it. In short, I didn't want to reinvent the wheel. Along the way, I was picking up bits and pieces about Google's bookmarking tool which was basically modeled after del.icio.us. Wanting to learn more about this led me to a program someone wrote that allows you to import your delicious bookmarks into google bookmarks. I decided to try this to see how they compared to each other. I found a Firefox extension that is very similar to foxylicious, but in my opinion, superior. True, it doesn't save your bookmarks locally, which may be construed as a negative for some users. But on the other hand, it's prettier, faster, and ultimately more convenient than the combo of foxylicious / delicious because it allows me to set up hierarchies in the folders it creates, which allows me to have folders within folders by adding a / to any tag. This makes everything a lot cleaner and easier to read. It's a real pain going through a long list of bookmarks trying to find what you want. It's so much easier when they're organized into smaller folders that are hierarchal and more specific. Anyway, I didn't exactly reach my original intended goal of writing that program, but I still managed to do something positive. Oh, and I got rid of all my dead and useless bookmarks.

Google Bookmarks
Google Bookmarks Button Extension
del.icio.us to Google

Screenshots of the Google Bookmarks Button Extension are available at the extension's homepage.

Read Full Post »

Friday, February 18 gave rise to...

So you want a hard drive in your PS2?

Editor's note, February 18 2007 -- I'm moving this post from my old blog. It's clearly my most popular post of all time, and given that there was no guide explaining this process in detail before I made this post 2 years ago, I have reason to believe that it has been absolutely instrumental in leading (thousands of?) people to understand how cool and easy it can be to have games on your PS2 hard drive -- so please, before you accuse me of plagiarism or whatever, check your favorite forum post or how-to guide and see when it was originally published -- I'm pretty sure I was here first. On the other hand, if you have proof that I didn't originate the organization and easy-to-read publication of this information (pretty sure we can all agree that "scene" forums are incredibly difficult to make sense of, which is really an entirely different topic that I'd love to explore some other time...), I'd be more than happy to hear about it. To see the old post with all the original comments, click here.

EDIT 2-22-05: I helped a friend out with this and we successfully installed a 250 GB Maxtor drive in his PS2, the L01R250. Just so you all know, these work too. They are on sale this week (until February 26th) at CompUSA for 99.99 USD, which is 70 dollars less than their normal price. So if you have not done this yet and need a hell of a lot of space, I can recommend this.

Ok. Let's get down to business. Here's what you'll need:


  • A Hard Drive! - Maxtor drives work the best. According to this chart, the Maxtor 6Y120P0 has had the highest success rate of all drives, and fits the easiest, et cetera. However, it will only hold 120 GB worth of games; most games are around 4 GB, so you'll be limited to around 30 Games for this drive. The earlier versions of the software needed to use the HD only support drives up to this size, but the newest releases can utilize drives that hold up to 200 GB. Only a regular IDE drive will work with the PS2. One can use another brand of drive, but then some tampering with the PS2 Network Adapter may be necessary. I went with the 6Y120P0 - bought it on eBay for $71.50 US including shipping. It fit perfectly, and has been hassle free so far (I've had this doohickey set up for about two weeks).

  • PS2 Network Adapter - I have one of the old-school network adapters as can be seen in the picture. Unlike the new one, it has a jack for a modem line as well as ethernet You need the official kind that hooks onto the back of the PS2: This is the ONLY way you can install a hard drive to your PS2. Looks like they are less than $30 on eBay. I think they're around $40 new.

  • Software to let you use the drive - Ok, this is pretty straightforward. You need a disc that you can use in the PS2 to let you load the games. This is something that needs to be purchased, unless your PS2 is already modded. But that's not what we're talking about here. We're talking about a PS2 that is unmodded, and will remain as such, but will be able to play "backups." I bought a copy of HDAdvance 2.0 from Consolepoint - 30.59 shipped. No problems or complaints whatsoever about the product or the retailer.

  • WinHIIP - Use Google to search for and download this program. Please do not tell me this is a difficult task. You will want this program if you are transferring backup images from your PC to the PS2.

  • USB Hard Drive Enclosure - I got a cheap but functional one from newegg.com (link to product). $29.99 with free shipping! You will want this if you are transferring backup images from your PC to the PS2.

  • PS2 - Ok yeah this won't work with the PSTwo. Sorry.
Ok, so let's see: $71.50 for the HD, $30 for the PS2 Adapter, $30.59 for the HD Advance 2.0 Software, and 29.99 for the HD Enclosure. That's $162.08, for those of you counting. Now that you have purchased everything you need and it's all shipped and everything and out of boxes and shit, let's get to work.



  • This is what your PS2 should look like from the front. If it's not looking like this, you have a problem that I must not be able to help with. Do not pass go, do not collect 200 Dollars. Sorry.




  • Your new Maxtor Drive.




  • A good look at business end of the network adapter. You can clearly see where the IDE and power cable from the hard drive will go (lower right and lower left sockets, respectively).



  • All of our friends together.




  • If you purchased a Maxtor drive as recommended, your Network adapter and drive should slide together very easily, as pictured above. See how comfortable that looks?




  • Slide the Adapter coupled with the HD into the PS2 as shown...and then secure it with the screws.
Ok, so that's about it if you're just backing up games to the PS2 HD. Just pop in a game, choose "convert" and wait for it to finish transferring to the disc. This will not work for dual layer games I hear. You need to first back up the image to your computer, then use another program to send that image to the PS2 Hard Drive. And this is one of the reasons one would use the HD Enclosure and WinHIIP program. Let's go over that now.


  • This is the enclosure when it's all closed up. It looks decent, but this sort of case is made for a drive that will be staying in the case all the time. Our drive will be in the case for only a few minutes, while data is being transferred to it from the PC. Therefore, it's more efficient to open it up and have it be ugly, like this:



Yup.



  • This is the drive working hard and being awesome and picking up hot hot games.
So now that our drive is connected to the PC, let's go through the WinHIIP motions:


  • Open WinHIIP

  • Select the PS2 Drive

  • Click "Add Image(s)"

  • Find the image file you're looking for...

  • Click Start...

  • Enter the name of the game

  • The game will begin transferring to the PS2 HD

Once you've transferred the game(s), you can just plug the HD back into the PS2 and load it up.

Have fun.

Read Full Post »
Loading...