Monday, July 13, 2009

Video, photos, and music sharing with my phone

I have a snazzy new geek-phone, a Shuttle from Virgin Mobile. It has a 4GB MicroSD slot so files can be exchanged with my Xubuntu system.

  • Phone Video is in .3G2 format. The video plays in Totem, but the sound doesn't. YouTube properly uploads and converts the .3G2 videos (no need to share by e-mail). I plan to archive the .3G2 videos in their original format. This command successfully converts the .3G2 to a .avi for viewing by totem:
    $ mencoder media/disk/my_flix/inputfile.3g2 -ovc lavc -lavcopts vcodec=msmpeg4v2 -oac mp3lame -lameopts vbr=3 -o Videos/outputfile.avi
  • Computer Video Haven't figured out the right command to convert movies to .3G2 yet.
  • Phone Pictures are in .jpg format. Xubuntu's standard Image Viewer is very effective for weeding through them.
  • Computer Pictures Large pictures take a long time to show up - a 2.4 MB image froze the phone for 30 seconds. The following script uses Imagemagick to resize the photos to a smaller size:
    $ convert Pictures/filename -size 320x240 /media/disk/my_pix/filename.jpg
    
  • Computer Music My FLAC music needs to be converted to .mp3 to play on the phone. Soundconverter does it, but some results refuse to play...haven't figured out the pattern yet.
  • Important information-
    UUID=5D18-F276  # The 4GB MicroSD Card's UUID. Find using syslog after plugging it in
    /media/disk     # Default mount point
    /dev/sdb1       # Device location
    /dev/sdb1 /media/disk vfat rw,nosuid,nodev,uhelper=hal,utf8,shortname=winnt,uid=1000 0 0   # /etc/mtab entry for the disk
    
    /media/disk/my_flix   /media/disk/my_music   /media/disk/my_pix    # Available folders
    
    Camera Resolutions: 1280x960 1024x768 640x480 320x240 176x144 160x120
    Video Camera Resolution: 176x144
    Screen Resolution: 220x176, 262k colors
    

Thursday, July 9, 2009

Installing Xubuntu 9.04 on an emachines E625-5192

Received my new laptop today - I need it for the fall, and got it a little early due to a sale.

What went well: I created a set of Restore DVDs (in case I want Windows back), then removed windows and installed Xubuntu 9.04 full-disk. Copied over my old /home directory, and installed all my favorite apps. E-mail, web, games, .bashrc, most dektop settings, etc. transferred without a hiccup. Recreated my crontab. Wireless networking and video work great. Built-in card reader reads all cards from my cameras and phone. Machine is noticeably faster. FN-key brightness control works. FN-key multimedia controls work.


Solved Problems:

  • Sound was tinny and a bit faint. Headphone jack works, not tinny, but low volume. Solution: Adding the following lines to /etc/modprobe.d/alsa-base.conf
    somwhat improved speakers and fixed the headphone jack.
    # Added by me on <date> while troubleshooting audio
    options snd-hda-intel model=6stack
    

  • The Volume-FN keys didn't work. Solution: Mapped FN-audio up, down, and mute keys by mapping them to aumix using these instructions.

  • The suspend FN-key didn't work. Solution: Enabled it in the gnome-power-manager preferences. It was set up to work out-of-the-box, but disabled by default.

  • DVD: DVDs play only after changing CDROM permissions after each disc insertion. Workaround: Created an alias in .bashrc as the 'fixcd' command

  • TomTom GPS automatic update doesn't work on Linux - Win and OSX only. Department of Defense forms and other applications are Windows-specific. Workaround: Installed a Virtual Machine (VM) to host an occasional-use XP instance.

  • Phone-made .3g2 video files play with weird audio - need a way to convert them. Computer .wma songs don't play on phone - need a lossless storage format, and a way to convert them to .mp3. Workaround: Upload videos to YouTube instead of the local hard drive.

  • Need password to restore from suspend (Xubuntu issue, not hardware-related). Workaround: Remove the screensaver package.

  • Unsolved Problems: No built-in webcam. Keyboard is different, and will take time to get used to - many typos in the meantime.

    Monday, July 6, 2009

    Creating Custom color palletes using The GIMP

    My spouse wants to create art using carefully-arranged Rubik's Cubes. She needs a tool to do it: She needs to manipluate images to the right color and pixellation to look cube-ready (Solving them to the displayed configuration is another issue).

    So let's set up The GIMP to do it.

    Preparation: GIMP needs to know what colors to use, so let's create a custom color pallette. (This only needs to be done the first time)

    1. Find an image or two with cube colors (Google is handy for this). Copy the images to your clipboard.
    2. Import the image to GIMP: File -> Create -> From Clipboard
    3. Create the new color palette: Image -> Mode -> Indexed -> Use Custom Palette -> Open The Palette Selection Dialog -> New Palette
    4. Select the six colors: Use the color-picker tool to change the foreground color, then right-click in the palette-editor to add each color.
    5. Save the new palette with a name you will remember, like 'Cube Colors'


    Changing an image

    1. Import the image into GIMP
    2. Reduce the image to the six cube colors - Image -> Mode -> Indexed -> Use Custom Palette -> Cube Colors
    3. Reduce the image to manageable size with Image -> Scale Image Pick a small size that is a multiple of 3 (3 rows/colums on each cube)
    4. NEED a way to split the image into 3x3 (blown up to 9x9) squares for each cube.


    Scripting for batch-resizing: This looks possible using Imagemagick - see "using pre-defined color maps" for an easy way to get Imagemagick to reduce the colors.

    Saturday, July 4, 2009

    Batch converting photos using Imagemagick

    Our store has a 7-inch photo frame, with a 2GB stick in it. So we can just drag-and-drop lots of photos onto the stick.

    But how can we use Imagemagick, the command-line photo editor, to batch-resize a whole bunch of images...perhaps as part of a script?


    Here's one way to resize a single photo:
    $ mogrify -sample 480 foldername/filename.jpg

    Here's one way to resize a whole directory of files from 4000 x 3000 to 400 x 300.
    $ mogrify -sample 400 foldername/*.jpg

    This resizes the original(s). Making copies (before the resize) is a separate command:
    $ mkdir copies
    $ cp original/image.jpg copies/
    $ mogrify -sample 400 copies/image.jpg
    $ mv copies/image.jpg stick/

    Thursday, July 2, 2009

    Installing a Samsung SCX-4725FN printer under Xubuntu 9.04

    Instead of the installation disks, I used these instructions

    Then go into Settings -> Printer -> Add New Printer and let it autodetect the new printer on the network.

    Wednesday, July 1, 2009

    Xubuntu 9.04 user-level login scripts

    Here is how to get a custom script to run at XFCE startup:

    1. Create a generic startup script and save it as custom_startup.sh. You can put anything in the script; in there now is only a logger so you know it's working.
      #!/bin/sh
      # This script is run automatically by xfce4-desktop during system startup.
      logger -i "Running the custom startup script"
      

    2. Create the following entry as /home/me/.config/autostart/MyStartup.
      [Desktop Entry]
      Encoding=UTF-8
      Version=0.9.4
      Type=Application
      Name=MyStartup
      Comment=
      Exec=bash /home/me/Scripts/startup_script.sh
      StartupNotify=false
      Terminal=true
      Hidden=false