home *** CD-ROM | disk | FTP | other *** search
/ ftp.lokigames.com / ftp.lokigames.com.zip / ftp.lokigames.com / open-source / smjpeg / SMJPEG.txt < prev    next >
Text File  |  1999-09-08  |  2KB  |  67 lines

  1. This file documents the simple animation format used by SMJPEG
  2. This is for static animation files, not for audio/video streaming.
  3.  
  4. All 32-bit and 16-bit values are stored in big-endian format.
  5.  
  6. 8 bytes magic - "^@\nSMJPEG"
  7. Uint32 version = 0
  8. Uint32 length of clip in milliseconds
  9.  
  10. One or more optional comment headers:
  11. 4 bytes magic - "_TXT"
  12. Uint32 text length
  13. arbitrary text
  14.  
  15. Optional audio header:
  16. 4 bytes magic - "_SND"
  17. Uint32 audio header length
  18. Uint16 audio rate
  19. Uint8  bits-per-sample  (8 = unsigned 8-bit audio, 16 = signed 16-bit LE audio)
  20. Uint8  channels         (1 = mono, 2 = stereo)
  21. 4 bytes audio encoding  ("NONE" = none, "APCM" = ADPCM compressed)
  22.  
  23. Optional video header:
  24. 4 bytes magic - "_VID"
  25. Uint32 video header length
  26. Uint32 number of frames
  27. Uint16 width
  28. Uint16 height
  29. 4 bytes video encoding  ("JFIF" = jpeg)
  30.  
  31. End of header marker:
  32. 4 bytes magic - "HEND"
  33.  
  34. Interleaved chunks of audio/video data:
  35. 4 bytes magic - "sndD" for sound data, "vidD" for video data
  36. Uint32 millisecond timestamp
  37. Uint32 chunk length   
  38.  
  39. // Comment -
  40. A single video chunk corresponds to a single frame of video.
  41. A single audio chunk corresponds to audio data not more than 4K uncompressed.
  42. (decoders may silently truncate chunks that contain more than 4K of
  43.  audio data, though a robust implementation would accept them.)
  44.  
  45. // Comment -
  46. The audio/video chunks should be more-or-less ordered according to timestamp
  47. so seeking by time works correctly.  Audio chunks should be ordered before 
  48. video chunks, and all audio chunks for a given frame of video should be 
  49. grouped together.  This results in good playback when scanning linearly.
  50. i.e. AAAV-AAV-AAAV-... (A = audio chunk, V = video chunk)
  51.  
  52. // Comment -
  53. The audio chunks should be encoded one frame ahead of the video chunks
  54. (i.e. current frame + next frame) so that if the decoder gets behind,
  55. the audio is queued up and doesn't underflow.  The decoder will quickly
  56. skip the next video frame and catch up.
  57.  
  58. // Comment -
  59. The ADPCM audio encoded chunk consists of:
  60. Uint16 valprev
  61. Uint8 index
  62. Uint8 unused
  63. ... compressed audio data
  64.  
  65. End of data marker:       
  66. 4 bytes magic - "DONE"
  67.