Updated Often.

Showing posts with label linux. Show all posts
Showing posts with label linux. 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 »

Sunday, July 13 gave rise to...

8bit killer



A brand new, free, 8 bit-styled shooter with 32x32 textures and a palette of 64 colors. It is inspired by games like Wolfenstein (obviously) and Metroid (not obvious until you play the game).

Download it here.

Oh, and it sucks in Wine, but I haven't yet tried any compatibility modes or other tweaks. Can you get it to work nicely in Wine? Please leave a comment.

Read Full Post »

Sunday, May 25 gave rise to...

Wuff ---- Wuff!



Wuff ---- Wuff!

Read Full Post »

Saturday, May 17 gave rise to...

Transform your computer from Kunta Kinte to Fela Kuti



Read Full Post »

Thursday, April 10 gave rise to...

Finches




Pidgin is a free cross-platform instant messaging client. The console version of Pidgin is Finch.

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 »

Wednesday, March 19 gave rise to...

Hardy Heron



So far, so good.

Read Full Post »

Wednesday, March 12 gave rise to...

Busy

Read Full Post »

Related Link

Wednesday, March 5 gave rise to...

Ubundork (March 2007)

Read Full Post »

Wednesday, February 27 gave rise to...

Shell.FM: The console-based Linux last.fm client

I imagine that most of you know about last.fm, the audio scrobbling service. Some of you probably even know that you can use their player after you've built a decent profile and it will play full tracks to you that it has calculated to be similar to your tastes. Fewer of you are aware that there are third party clients that do the same thing but with less bloat and no advertisements. A good graphical client that does this for Linux is Last Exit. I'm not talking about Last Exit though. I'm talking about Shell.FM. It's a very simple, very usable, very fast CLI program that plays tracks from last.fm.

It's my audio player of choice when I want to listen to a somewhat random directed subset of music that isn't on my computer.

Here's a screenshot of it:



Ugly? Sure.

Minimize it, asshole

Shell.FM Homepage

Read Full Post »

Tuesday, February 26 gave rise to...

Ubuntu 8.10: Intrepid Ibex

During the 8.10 cycle we will be venturing into interesting new territory, and we'll need the rugged adventurousness of a mountain goat to navigate tricky terrain.
-- Mark Shuttleworth
Cool. An Ibex is in the same family as the Gnu -- which is also related to the GNU if you catch my drift.

Clever work.

Read Full Post »

Related Link

Tuesday, February 12 gave rise to...

Post in which I attempt to fluff MPD, the Music Player Daemon for Linux

This will be short. I can't promise sweetness, but I believe in my heart of hearts that it isn't an absolute bitterpost.


Screenshot of two MPD clients, Sonata and ncmpc, side by side

Why use MPD and MPD-clients like Sonata and ncmpc?

  • much faster than most other music players
  • lower memory usage than most music players
  • you like trying new software (getdeb.net is a great place for this too -- if you use ubuntu or something like debian)
  • you enjoy (or think you might possibly enjoy) some command line hacking
  • you want to be able to access your music through multiple intuitive interfaces whenever you want to change things up a little (gmpc, sonata, ncmpc, MANY others)
  • simple and unique playlist management
  • very polished underlying daemon, some very polished clients
If you're already using Linux and have some free time, you have nothing to lose.

Read Full Post »

Sunday, February 3 gave rise to...

Renoise is the only Linux music production program that has made sense to me so far.

Prince - Sign O' The Times (1987)Renoise

So far, composing music on Linux is very, very hard.

I should mention that I was never really indoctrinated into the usage of such programs in Windows, and that I know nothing -- really, nothing -- about electronic composition.

I have tried many music production programs on Linux, and I've had success with virtually none of them. I'm not saying that the other programs that I can't seem to use are not good, but they definitely aren't good for me (not yet anyway). Renoise is a commercial product but recently they announced work on a Linux version and yesterday they released a trial version. It's simple to install provided that you have a few dependencies (and they're common to other music programs for Linux -- dependencies such as JACK). Once you get it up and running the interface seems fairly intuitive. I haven't tried making anything of my own yet, but I was able to make alterations to a sample song fairly simply. If I play with it more and really like it, well shit, maybe I'll even end up buying it; but in truth, it's far more likely that I'll use the trial to try to learn some things that can be applied to freer programs.

If you're like me insofar as you haven't had much luck composing music on Linux because of a lack of a starting place, download the Renoise trial and see if you can get it to work for you. One of the great downfalls of many otherwise excellent free/open source software projects is that the documentation is either scattered (this seems to be the case for many Linux music projects out there -- I have yet to see a cohesive documentation repository that tells anyone anything about how we can create music for fun on Linux), or it's written such that only the adept have a fair chance at understanding the documentation. There are no beginners guides! This latter issue is a problem in free software in general, but it is getting better overall with distributions like Ubuntu that welcome new users and have ways of educating them without forcing them to read tons of manpages. See Audio in Linux is awesome, a simple 39 step guide to editing an audio file in Linux for a pretty good illustration of the kind of frustration I'm talking about here.

The next step for me will be learning more about how computer music programs work so that I can use them to make things that I like listening to. I have a very strong suspicion that this wouldn't ever be as much of a chore if I actually had some kind of electronic instrument whose output I could feed into my computer...

Read Full Post »

Monday, December 31 gave rise to...

Plugin Suggestion For Compiz Developers

When I'm browsing around with tab and shift tab (when I want to navigate different "fields" without using my mouse), it would be very convenient to have some sort of shaded overlay/border around the field that I'm currently in. It is often very difficult to tell what field you're in -- in GNOME, some have a very thin dotted outline, and others have nothing at all. When it's text, the text gets highlighted...sometimes.

Mock-up (click to enlarge):




Also see this.

Read Full Post »

Tuesday, December 18 gave rise to...

Idea for Gnome Panel's Window List Applet

The Window List, a popular -- and some might say, integral -- widget for Gnome's Panels could use an upgrade. I propose these options:

  • view icons only -- in this mode, if one wants to know the title of the window, they can position the pointer over the window's box
  • option to group window list items by workspace #
    • example: I have three tomboy notes windows open, two firefox windows, two file browsers open, and one terminal. They are spread across all desktops. I would want the windows on the bottom to rearrange themselves to match up to the desktops that they correspond to. The window list can be visually partitioned by some sort of high contrast divider between window list items on different desktops. [Gnome 2.20's release notes say that 2.20 shipped with a similar feature in its Window Selector panel widget, but I do not see this functionality there either.]
What changes or features would you contribute to the Window List, if you could?

Read Full Post »

Tuesday, October 30 gave rise to...

Bliss? Clearly, Sonata/MPD has never listened to Pig Destroyer



I guess most of the rest of this is pretty accurate though

Read Full Post »

Friday, October 12 gave rise to...

This Is How A GNU/Linux (Free) Desktop Can Look Part 2



Read Full Post »
Loading...