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.

No comments:

Post a Comment