FirstClown

firstclown at firstclown.us

Posts Tagged ‘linux’

Hard Drive Sleeping in Ubuntu

I've been having trouble with my hard drive going to sleep in Ubuntu 8.04. It seems that whenever I go off of AC power, the hard drive gets set to a very low power setting and a quick sleep mode, even after I plug it back in.

I'm able to reset it back to a usable setting by running:

sudo hdparm -B 252 /dev/sda
sudo hdparm -S 250 /dev/sda

Not sure if anyone else runs into this problem. I'll probably try and get this into an init.d script, but it really doesn't affect me all that often.

Backing Up Applications

I've gone back and forth on whether or not to backup applications. Backing up user preferences for applications is a must, but the value of backing up the actual application files is more up in air.

One of the things that makes this hard to mandate a backup rule about applications is the fact that applications act differently on each platform.

Mac

The Mac might be the one platform where I could see backing up the applications. Most Mac applications are self contained and can be recovered by simply dragging and dropping them back into the Applications directory. The only issue to watch for is an application's size, which could get pricey for remote backups. If that's not a concern I would say, for the Mac, backup your applications.

Windows

Windows applications are different since they install, not just the applications, but a lot of other auxiliary files and registry entries. Running applications without all these other files can have unexpected results. It makes more sense to backup the installer programs and not the installed application.

Remember to also backup the Application Data folder in your user directory. That's where all your preferences are stored for most of your applications.

Linux

Although Linux doesn't have a registry, applications do install a lot of data into various directories in the system. There's /usr, /usr/local, /var and so many others that it's hard to tell if you've gotten everything or if the permissions are right once you've recovered your data.

Luckily with most Linux distributions, all the applications you have installed are in the central repositories and can just be reinstalled with a simple command line call. There's no need to backup most of them when they can all be gotten from a central online location.

I will backup things that I've installed myself, usually under my home directory or in /opt. It's also important to backup application preferences in your home folder. But, you don't need to backup your applications under Linux.

Conclusion

In general, for Mac, go ahead and back them up. For Windows, don't bother, but backup the application installers if you can. For Linux, backup a list of the applications you have installed, then just run your package manager to get them all back out again.

Have any other ideas on how to backup installed applications?

Getting an AlphaSmart to Work Under Linux

I got to play with an AlphaSmart 3000 recently and am actually going to be buying one of my own. One problem I was warned about was that it didn't quite work under Linux. Since the AlphaSmart just acts like a USB keyboard to the computer when transferring files I figured there was just some crazy little things that needed to be done to get it to work.

Well, I was right. There is a crazy little thing you need to do.

Here are the steps to get the one I was working with to work under Linux:

  1. Turn on the AlphaSmart
  2. Plug it into the computer's USB port
  3. Turn on the Num Lock key on the computer's keyboard. You must do this before hitting any keys on the AlphaSmart
  4. Try typing on the AlphaSmart keyboard to make sure it's transferring

After that works, you can use the AlphaSmart to transfer your files like you normally would.

Transcoding DV to Widescreen MP4 in Linux

When I export video from Cinelerra in Linux after editing, I always render as Raw DV. It takes a lot of harddrive space, but I've never gotten any other format to work in Cinelerra, especially when my finished video needs to be widescreen. Luckily, Linux has some great tools for transcoding video. One of the most popular is ffmpeg.

I'll usually render the video to DV and then run the following commands to get it into an MP4 that is widescreen:

ffmpeg -f dv -i RenderedVideo.dv -pass 1 -vcodec h264 -g 300 -mbd 2
    -cmp 2 -subcmp 2 -deinterlace -aspect 16:9 -s 640x360 -padtop 4
    -padbottom 4 -b 768k -acodec aac -y Final_vodcast_render.mp4

ffmpeg -f dv -i RenderedVideo.dv -pass 2 -vcodec h264 -g 300 -mbd 2
    -cmp 2 -subcmp 2 -deinterlace -aspect 16:9 -s 640x360 -padtop 4
    -padbottom 4 -b 768k -acodec aac -y Final_vodcast_render.mp4

MP4Box -add Final_vodcast_render.mp4 Final_vodcast.mp4
MP4Box -par 1=1:1 Final_vodcast.mp4
rm Final_vodcast_render.mp4

A little explanation may be in order.

The first line is a first pass of the video encoding. It's really there just to gather data in order to optimize the real encoding. You could throw away the final video file created by this, but I always choose to keep it around.

For a real understanding of all the options, take a look at this page that lists all the options and tries to explain them. Important ones are:

  • -vcodec: The video codec we want to use. Internet standard at the moment is H.264
  • -deinterlace: My camera records for standard TVs (640i). If your's does too, you'll need to deinterlace the signal for internet video
  • -aspect: Need to set it to widescreen which, for my camera, is 16:9
  • -s: This is the final size of the video, 640 pixels by 360 pixels
  • -padtop,-padbottom: Video needs to be processed in 16x16 pixel blocks. Since 360 is not divisible by 16, I need to make sure the height is divisible by 16. Adding a 4 pixel line of black padding pixels to the top and bottom makes the height 368, which is divisible by 16
  • -b: The bitrate of the video. 768k is a little big for internet video, but it keeps the quality up there for Apple TV and what not.
  • -acodec: The Audio codec we want to use, AAC
  • -y: Overwrite files, needed on the second run

The other options are really just things I got from other people on what to set to get this to run on an Apple TV. I felt that was important enough for my podcast to keep them in there. Blip.tv actually does a good job of converting this to an iPod friendly format, so I won't go into the nightmare that is transcoding video in Linux for the iPod. I actually don't think I even got a good iPod version in all the times I tried it.

The last three lines basically fix the MP4 that ffmpeg created. It would mess up the pixel aspect ratio (PAR) and I just reset it here to 1:1 square pixels.

Syncing Audio and Video in Linux

After PodcampOhio, I realized that I've got quite a few video editing ideas to share with those of you who use Linux. This first one is how I sync my separate audio and video files.

I film STeaP TV with a Panasonic H200 and, while a great camera, it doesn't have a mic input so that I can easily sync up audio recorded out of the camera with the video in the camera. In order to do that, I have to export the audio from the video file, sync the better audio with the camera audio and then overlay the better audio on the video in new MPEG file.

Important tips while filming: start your audio recording first. You'll see why later. Also, when you've just started recording, slap two boards together or knock on the table or something. Really any thing that created two sharp spikes on the audio and do this before you really start doing anything. Everything before these spikes will be unusable after syncing.

Extracting the Audio

First you'll want to extract the camera audio from the video file. If the video file it MOV002.mpg, you can do that with:

mplayer MOV002.mpg -vc null -vo null -ao pcm:fast

You'll now have a file called audiodump.wav.

Syncing the Audio

Now we want to change the better audio to be synced with the camera audio. We can do that by, while filming, slapping some boards together to get a spike on the audio wave form. We can then load them both in Audacity and match up the spikes.

To do that, we zoom in to see both spikes on the screen, highlight from spike to spike in the better audio:

Before Sync

And then cut!

After Sync

Now, highlight the better audio track and Export Selection... as MP3.

Overlaying The Audio on the Video

Now that the two audio streams have the spikes in the same place, the better audio is automatically synced with the new video! So now we just overlay the better audio on the video.

If we saved the better audio as BetterAudio.mp3 we can create a new video file called Episode.mpg like this:

mencoder MOV002.mpg -o Episodetest.mpg -ovc copy -oac mp3lame
      -audiofile BetterAudio.mp3 -of mpeg

Voila!

FirstClown is powered by WordPress
Entries (RSS) and Comments (RSS).