Sunday, February 17, 2013

One Week Linux Challenge - Day 4

Day 4
Getting Music

     My crank radio is out of juice this morning, and it's eerily quiet in my room without the normal whurrrrrrrrrrrrrrrrrrr of my desktop. It is another day of Linux, and one I've been both looking forward to and dreading since I started this challenge.
     I had been a lazy boy, and only used iTunes to get music for the past four or five years. I come to know various mistresses along the way; Bearshare, Limewire, the Pirate Bay...but due to the current political climate here in the United States, it's too risky to be stealing music using such loud means. I had actually known this even when I was using windows. There was a golden era where you could use Gnutella and P2P as much as you wanted without fear of getting caught, but now you can guarantee yourself some hefty fines if you're stealing music a few days a week.
     Since this crackdown, I had been using sites that would allow me to rip youtube videos down into .mp4 or .flv, which I would then use either Windows Movie Maker or a simple audio program to tear it down further to an mp3. Now it feels like those sites are being sought after!
     After a little digging around this morning, I found the most amazing tool for Linux called Youtube-dl. You go on youtube, find the song you want and copy the URL, then head over to your favourite terminal (I've taken a liking to Guake), and type 'youtube-dl theurl' and hit enter. It automatically defaults to the best quality video available, and begins downloading it. Here's the best part; It'll even download a play list that you create. So if you want, you can go hunt down 150 songs and throw them into a youtube play list, then send the playlist URL to youtube-dl and it'll happily do all the dirty work.
     I wish I could have captured my face when I realized what this tool could do.
     I had to figure one last crucial step though. Now that I had all these raw videos, is there a way I could possibly split the audio apart from the video? Sticking with the motif of CLI based functions, I again turned to my good friend google. (For anyone new to Linux, I swear this; Google is your friend), and found a tool called ffmpeg. Literally the man pages say, "ffmpeg video converter". 
     I spent the next 15 minutes reading through it's man page, and picked up pretty much all the information I could need. It could convert my random .flv (flash video) and .mp4 files into .wav files, which was almost good enough. I wanted mp3, and I wouldn't settle for any less. There exists yet another program called 'lame', and it's job according to the man pages is to 'create mp3 audio files'. Don't you just love how straight forward the information on the man pages are? 
     In the end the command sequence looks something like this; 
  1. Find a song on youtube.
  2. 'youtube-dl --title songurl'
  3. ffmpeg -i songfile.format newname.wav
  4. lame newname.wav newname.mp3
  5. rm *.wav;rm songfile.format
     Boom. You have yourself a totally DRM free, solid quality mp3 file that can be easily uploaded to any basic MP3 player, and works well in every music player. And it all works on Linux without a hitch.
     To give this process a catalyst; I do it on my EEE through SSH, so that I'm not hogging the bandwith of my x220 while I'm working on it. 
Part 2

      Look, I know I said in the beginning that I didn't do this to see what games I could get running under Wine, or to Install Steam. But I have a 2000$ Steam account, and it would be a crime not to keep an eye on the suddenly fast growing world of Linux gaming
      Truth be told, I just want to share my experience of running native Linux games on an x220, which is like, the farthest thing away from a gaming laptop. 
      On first boot Steam tells me that, in order for everything to work properly I need to add a PPA to my software sources. Something for x-updates. After a quick lesson on how to add a PPA, I added the one listed from Steam, and ran my typical script to make sure everything was in order. Steam booted up. I poked around the interface just out of curiosity to make sure all of the features worked. I checked out the store, community pages, game hubs, forums, and they all seemed in working order. It was actually quite surprising because I had taken a dive into Linux gaming before when the Steam beta started, and hardly anything was functioning then. 
     I only wanted to test one or two games. I wanted to keep away from anything that would become too big of a time sink; CS:GO, RPGs, or anything like that. To my luck, there are only twenty or so games ready to be installed, so I chose Beat Hazard, Sword and Sworcery, and Steel Storm, three quick arcade like games that you can enjoy for quick bits at a time. 
    Apparently though, Beat Hazard doesn't work yet? It's listed in my library, but it takes .0005 seconds to install and then complains that there is no executable. Sword and Sorcery worked fine, as well as Steel Storm, but poor Beat Hazard hit the floor without taking one step.
    The gameplay of 3D games was as I expected; slow and choppy even at low quality. 
    I installed Torchlight 1 a while back through the Ubuntu Software Center only to find out it was a buggy mess of crashes and glitches at the time. I figured I'd give it another shot now since it's been a good few months since it's release. To my surprise, the same bugs and graphical errors still existed. I hope that porting a game and then abandoning it doesn't become a popular thing to do among developers in the Linux gaming world.
    My final quest was to see how CS:S would run. I knew it was going to be a long shot, since Steel Storm and Torchlight ran at 25-30 frames at most. Surprisingly, it wasn't awful. It as smooth enough to play, and I enjoyed a few quick rounds against some bots on Dust_2, barely hindered by a jumpy frame rate.


    I have to admit, it has been a great week thus far. Not because I switched to Linux, but because when I was using Windows, I was always dumping my time into useless things. I was on Reddit, I was on youtube, I was playing games. But now, I'm spending a majority of my time learning about Linux. I've been more motivated to learn in general, and get more active away from my keyboard. I just have this feeling around Linux that computers aren't a place to go if you want to waste time, but a place to go where you can learn. A place where, the more time and effort you put into it, the more productive you can be. I'm trying to let this lesson seep into the rest of my life; Never be happy with being good at something, because you can always get better. Working with Linux has humbled my view on computers. On my Windows machine I kind of though I 'knew it all', or at least enough to consider myself beyond proficient. But Linux is so much more...complex. I feel so much smaller, but in a good way, a way which keeps me fighting to increase my size and presence in the world around me.   


  1. youtube-to-mp3

    Search for that in the Software center. :)
    I had actually just finished reading this, when I went to the software center to play around. That was on my frontpage.

  2. You don't actually have to do two conversions. Ffmpeg (or actually, avconv, which is the preferred fork of ffmpeg in Ubuntu) can do it for you in just one step:

    avconv -i songfile.format songfile.mp3