About Me

My photo

Application Developer who loves writing beautiful code and enjoys learning something new everyday.

Wednesday, June 20, 2007

Images and videos for Sansa E250

After several days of researching, I finally found a way of encoding photos as 16-bpp bitmap images for my Sandisk Sansa E250 Media player on my Mandriva Linux 2008.1 desktop.

Gimp 2.4 (I’m using 2.4.5) supports saving of 16 bpp bitmap which works on the E250. First crop and scale image to 176×224 pixels. Then flip the image vertically, so that top becomes bottom and vice versa. Finally, save as bitmap. A dialog box will appear that provides Advanced Options. Expand it and select “16 bits R5 G6 B5″.

I can now view my photos using my media player. :)
Grant, from http://www.visi.com/~grante/sansa, provided a script to encode videos for the E250, but only in black-and-white. I modified it to encode audio to standard pcm codec, instead of Grant’s specially patched pcms. Then I run it though ffmpeg to convert the audio to big-endian format.

Here’s how my script looks like (it writes to a temporary file) :

mencoder -ofps 15 -vf rotate=1,scale=160:208 -ffourcc mjpb -ovc lavc -lavcopts vcodec=mjpeg:vbitrate=150:vhq:gray -oac pcm -srate 11025 -of lavf ${1} -o /tmp/video.mov

ffmpeg -i /tmp/video.mov -vcodec copy -acodec pcm_s16be ${2}

rm -f /tmp/video.mov

Note that older versions of mencoder, prior to 2008 I think, required the following option.

-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames

in order to produce a video that works on the E250. This is no longer the case with the current version.

Tuesday, June 12, 2007

SanDisk E250 + Linux


I purchased a SanDisk E250 Media Player with 2GB storage, mainly to play MP3s, but it also views images and plays video clips. It was on sale in JB Hi Fi, so I paid A$168 for it. I’m using it with my Mandriva Linux desktop PC at home.

I’ve only played with it a few hours. Despite good Linux connectivity support, there are some annoying shortcomings that dragged this product down.

Here are the pros and cons (in my opinion):

Pros:

  1. Very easy USB connectivity to my Linux PC. Just set it to use Mass Storage mode and it automatically mounted when plugged into the PC. This is a VERY BIG PLUS for me, since Linux is all I use.
  2. Clear screen, good quality sound.
  3. Intuitive and easy-to-get-started interface.
  4. Supports Chinese title text (but only after changing the language to Chinese).

Cons:

  1. Does not seem to be able to group songs into directories. All songs from all sub-directories are listed. There is however a play-list that one can add songs to, but only one play-list. It does grouping based on ID3 v2 tags, so I work around this limitation by setting the Album tag using a little program called id3v2. Its still a hassle to have to manually set this tag for all the MP3s that I upload to the player.
  2. Very limit support for image ( 16 bpp BMP) and video (MJPEG Quicktime) formats. The player comes with a Windoze-only media converter software that’s useless to me of course. Gimp can now be used to save images as 16 bpp bitmap. Video encoding is also very tricky as most other blogs on the Web are also complaining of the difficulty of encoding to the very peculiar color format. Hopefully someone out there knows the required mencoder options for this. I have no idea why SanDisk chose such weird formats for an otherwise very capable player. Very frustrating!
  3. Built-in batteries that can only be charged when plugged into a computer’s USB port, and the computer must be left on. There is an option to use a AC adaptor, but that’s an extra accessory.

Overall, I can only give it a barely passing mark.