Tag Archives: Ubuntu

Problems Mounting Drives Under Linux

Lately I have not being having much luck with mounting external usb drives in my Ubuntu 8.04 install. All that seems to happen, is that the drive will appear under “computer” but that is about as far as it goes. When I click on the external drive it just errors and does not open. So a solution that I discovered on the net uncovered part of the solution but I will attempt to put it together for you ๐Ÿ˜‰ .

First of all you have to work out where you drive is mounted and what it is called. Under the Ubuntu distro, they are located under eg. /dev/sdb or something similar to that. The only thing that will change is the letter on the end. If you are not sure of which one you external drive is, you can unplug the drive then run this command :

ls -la | grep sd

Then plug the drive back in and run that same command to see what drive appears. This will tell you what the drive identifier is. Another way you might be able to find this information is by running the command :

dmesg | tail -n 50

This command will show you the tail end of the error message log, so from this you may also be able to determine what the drive identifier is from the message :

[ 2159.443365] FAT: bogus number of reserved sectors
[ 2159.443371] VFS: Can't find a valid FAT filesystem on dev sdb1.
[ 2159.488509] FAT: bogus number of reserved sectors
[ 2159.488515] VFS: Can't find a valid FAT filesystem on dev sdb1.
[ 2159.661736] FAT: bogus number of reserved sectors
[ 2159.661742] VFS: Can't find a valid FAT filesystem on dev sdb1.

As you can see from this message, it is telling me that it is trying to mount my drive as a VFAT system which is incorrect as it is actually NTFS. Now that this has identified my problem I can run a few commands to see if I can get it mounted. First I will make sure it is unmounted before I try to remount the file system:

sudo umount /dev/sdb1
umount: /dev/sdb: not mounted

That was just telling me that is was not already mounted, now I will create a directory for the file system to be mounted into. This can be anywhere you like but the standard spot in ubuntu is “/media/”. So next I run the command :

sudo mkdir -p /media/external_drive

Then if I am lucky all I have to do is mount the drive using :

sudo mount -t ntfs /dev/sdb1 /media/external_drive

Now you should be able to navigate to the folder you just created and view/edit the contents of the drive. If this still failed, try running the original dmesg command and see if you can track down what the problem is.

Normalizing Your Music

Listening to un-normalized music can be a painfull thing, considering one second it will be a normal volume and the next you will be deaf :omg . Anyway, I had a bit of a look on the net for a solution and by using Mp3Gain this is actually a pretty simple solution to fix.

Basically, Mp3Gain has the ability to normalize the volumes of all music without actually editing the mp3 files. It does this by analysing the levels and applying tags to the files which lets the player know how much to increase/decrease the volumes. The good thing is that it can do this over albums, to make the files pretty generic in their levels. Another good thing is that this can be done with a one liner ๐Ÿ˜‰ . First install then run:

sudo apt-get install mp3gain
find . -iname '*.mp3' -execdir mp3gain -a -k "{}" + &

What that command is doing :

    find . -iname โ€˜*.mp3โ€ฒ
  • searches for all mp3 files.
  • -execdir
  • executes the command on a directory basis.
  • "-a"
  • tells mp3gain to use Album gain instead of Track gain (very important!)
  • "-k"
  • tells mp3gain not to increase the volume with no distortion.

For windows users this is a lot simples considering all you have to do is open the gui and tell it to run! ๐Ÿ˜› .

Convert Video for Xbox 360

This is just a walk through on how I have managed to convert video for playback on the 360 from my Ubuntu Hardy install. Basically, I could not be bothered setting up the whole media center and all of that type of stuff. I did gave uShare a “very” quick go but could not get the xbox to connect so I gave up. Pretty soft of me wasnt it ๐Ÿ˜› .

Anyway, after that effort I went searching for what the xbox will actualy support in the way of codecs and found some usefull information on the support site. This had me thinking “sweet” considering most of my shows are already in avi. But, as usual it was not going to be this simple. I spent ages trying all of the different codecs and kept getting nothing. The xbox would either show the red cross of death, play audio and no video or the other way round. I spent ages trying all of the different converstion, including video codecs and audio codec combinations. However, after all that stuffing about I noticed on the support site that the video/audio and extenstion information had to match, as well as the container. Now, I am not sure if this is something that everyone knows but I personally had no idea about the container??

Armed with this new information I tried the H.264 codec with the AAC audio and MPEG4 containerย  but to no avail. So, I just went straight for the wmv+wma+asf combination and omg it worked. Now I know I should have tried the other combinations, as they are better. But after hours of frustration I was totally over the whole process and not even remotely interested in watching the show that this was all in aid of :( . Ok, so I will show you the command that I came up with and it “should” convert any format over to the required xbox format:

mencoder "BBC-Planets_9.avi" -o "BBC-Planets_9.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2 -oac lavc -lavcopts acodec=wmav2

You should already have mencoder installed but if not just :

sudo apt-get update
sudo apt-get install mencoder

Well just a brief description of the code is :

mencoder "BBC-Planets_9.avi" -o "BBC-Planets_9.wmv"

This section will take the input file of type avi and output to file type wmv. However, just remember this is only a name and does not have any smarts based on the extension. The next section is to do with the container that I was talking about earlier :

-of lavf -lavfopts format=asf
  • The “-of” stands for output format
  • The “lavf” is the codec you have chosen to do the conversion for you
  • “-lavfopts” is the options command specific to that codec “lavf”
  • “format=asf” and this is creating the video using the container asf

Next is the output video codec information :

-ovc lavc -lavcopts vcodec=wmv2
  • “-ovc” stands for output video codec
  • “lavc” is the library you have chosen to transcode you video, This is chosen based on the format you need.
  • “-lavcopts” the options command specific to lavc
  • “vcodec=wmv2” use lavc’s wmv2 library to convert the video to wmv

The final part is the audio codec information :

-oac lavc -lavcopts acodec=wmav2
  • “-oac” stands for output audio codec
  • “lavc” is the library used for transcoding to this audio type
  • “-lavcopts” is the options param for lavc
  • “acodec=wmav2” tells the transcoder to convert the audio to the type wma

Now that is pretty much it. I did spend a lot of time looking though the forums but most of the solutions did not work. All of the information needed was from using the man page of mencoder and the xbox format requirements on the page listed earlier. At some stage I would like to have a go at getting some of the other formats to work as well as having a look at vpass=2 which should make the video a lot better. When I do I will list the new command on the page for you guys.

Update:

Hey Again, this is just an update that might be useful for getting a little better resolution on the files

For first pass run this one:

mencoder -noskip "BBC-Planets_7.avi" -o "BBC-Planets_7_1.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2:vbitrate=5000:vpass=1 -passlogfile "libvcodecstats.txt" -oac lavc -lavcopts acodec=wmav2

For second pass run this one:

mencoder -noskip "BBC-Planets_7.avi" -o "BBC-Planets_7_1.wmv" -of lavf -lavfopts format=asf -ovc lavc -lavcopts vcodec=wmv2:vpass=2 -passlogfile "libvcodecstats.txt" -oac lavc -lavcopts acodec=wmav2

Note, you might also want to check out different vbitrate settings?

Adobe Air in Ubuntu Hardy Herron

I had recently started using Twitter as suggested by a friend and it seems pretty cool. But, because of its fast and lite nature I needed some “pretty” way of posting and tracking my friends on it. I did the usual thing of searching the net for gnome packages and some were ok, but most were lacking and average. Anyway, I had a look for a similar thing on my windows machine, and came across spaz. This is a “widget” type install for the new Adobe Air . The adobe air suite allows widgets like spaz and analytics reporting suite to sit on the desktop, similar to the new vista style widgets.

Anyway, enough crapping on… The cool part is that, Adobe has released a package for linux :) . This is sweet news that they have taken the time to develop for linux, it is only in the Alpha atm but should be in beta very shortly. Here is a pic that shows the Analytics plugin and the Spaz one :
[singlepic=4,320,240,,]

The install is pretty straightforward:

  • Download the deb package from adobe
  • Run these commands on the downloaded file :
  • chmod +x adobeair_linux_a1_033108.bin
    sudo ./adobeair_linux_a1_033108.bin
    

The package management system should take over from here, and .air packages should be installed with a double click from then on.

The plugins that I think are pretty sweet are here :