2008-12-26

More on Sansa Fuze's video format

Sansa Fuze MP3 player only supports a very specific version of the AVI file format for it's video output. This format is not documented anywhere and can only be, as far as I know, produced with Sansa Media Converter (SMC) Windows program. I have spent some time familiarising myself with the video files produced by SMC. This blog post was written to document some of the aspects I have learnt so far.

I hope at least someone finds some interesting information here and perhaps we can come closer to a working video conversion. This is still very much a Work in Progress. I intend to update this entry if any new information pops up. I'm also happy to answer any questions I can in the comment section. See also my previous entry on this subject.

AVI files

AVI files consist of chunks. For a recent general discussion of AVI files, see this pdf file. If you use Python, AVI chunks can be read, for example, with Python's chunk module. See Python's reference page for a nice explanation of chunks in general.

AVI file is actually a RIFF file. A standard RIFF files have 3 types of chunks. First comes the "RIFF Form Header". Then there are normal chunks and list chunks.

A chunk has a 4 byte identifier, a 4 byte chunk size, followed by the actual data. A list chunk has identifier 'LIST', a 4 byte chunk size, a 4 byte list identifier, followed by data. RIFF Form header has identifier 'RIFF', a 4 byte file size, a 4 byte form identifier (in this case, 'AVI '), followed by the actual data, in this case the other chunks.

File Structure

Fuze's video format is, in essence, a standard AVI, but the requirements for a working file are specific. I analysed a very short example file generated with SMC. In this example file, the file structure was as follows:

  • 'RIFF' form header

  • 'hdrl' LIST chunk, header information

  • 'avih' chunk (56), avi file headers


    • 'strl' LIST chunk, which describes the video stream


      • 'strh' chunk, stream header

      • 'strf' chunk, further stream description

      • 'indx' chunk, odml stream indexing


    • 'strl' LIST chunk, which describes the audio stream


      • 'strh' chunk, stream header

      • 'strf' chunk, further stream description

      • 'indx' chunk, odml stream indexing

      • 'JUNK' chunk, which is just filler

    • 'odml' LIST chunk, OpenDML header list


      • 'dmlh' chunk (248), OpenDML header chunk


    • 'INFO' LIST chunk


      • In this case, this list chunk has just one subchunk called 'ISFT' (software), with the string 'InterVideo\x00\x00'.


    • 'movi' LIST chunk, containing the actual video and audio data as subchunks


      • In our example, this list chunk has just 4 subchunks called, ix00, ix01, 00dc, 01wb. The first two are odml index chunks, the third one is video, the last one is audio.


    • 'idx1' chunk. Legacy index chunk that is actually not required by Sansa Fuze.



Some observations

Here are a few random observations about Sansa Fuze's video files.

  • Wrong ulFlags in the avih header do not affect playback. It seems that the player just ignores this and in fact much of the headers.
  • idx1 chunk is not required. Apparently it is not even read before playback reaches the end.
  • Fuze uses OpenDML (AVI2) indexing. 'odml' chunk is absolutely required. So are 'indx' subchunks under 'strl' chunks, and ix## subchunks under movi chunk. Mencoder unfortunately only creates odml compatible files if file size is greater than 1 GB. I have tried modifying the sources so that odml index is created every time, but these files do not seem to work any better. It is probable that Fuze doesn't like Mencoder's method of starting a new RIFF chunk whenever odml index is used. Perhaps there is another encoder somewhere that can create the odml chunk every time. I understand that Windows program VirtualDubMod creates OpenDML compatible files, but I haven't had the time to find out how well it works.

Further information

A few sources of information about AVI files in general:

2008-12-06

HP Laserjet 1020 and Casio EX-Z80 on Ubuntu 8.10

A few notes on two devices I tried today.

The printer, HP LaserJet 1020, was a bit odd. Once I plugged it in, Ubuntu 8.10 (Intrepid Ibex) seemed to recognize it and installed drivers. But when I sent a test page it was never printed. There were no error messages or anything, though. This thread on Ubuntu Forums helped. The relevant part:
  1. sudo apt-get install hplip-gui
  2. Delete earlier printer setup in System->Administration->Printing
  3. sudo hp-setup, next->next->next
  4. System->Administration->Printing, right-click on the printer icon, make sure that it's enabled
Once again, my thanks to those who provided this information on the forums. You saved me a lot of hassle.

The camera, Casio EX-Z80, worked without problems. It was instantly recognised by Ubuntu and data transfer worked nicely.