MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: AVI with sound

  • To: mathgroup at
  • Subject: [mg115173] Re: AVI with sound
  • From: telefunkenvf14 <rgorka at>
  • Date: Mon, 3 Jan 2011 03:57:49 -0500 (EST)
  • References: <ifpk9k$bt0$>

On Jan 2, 4:33 am, Borut Levart <bol... at> wrote:
> I use Mathematica as a video editor, importing frames from camera and
> ordering them as I please before exporting. It satisfies my needs,
> almost -- for I would like to include sound, a sound track, but I
> don't know -- is Mathematica able to do this?? AVI stands for audio-
> video ...

Interesting question, somewhat related to one I just asked regarding
Importing WAV files...

1. According to the documentation, WRI confirms (of course) that AVI
does support a variety of audio and video codecs. However, there are
no examples in the documentation of working with video+sound, just one
or the other. (If someone can point one out, I'd like to know!!) I'm
guessing this is due, in part, to the fact that the audio data
embedded in any given AVI may be of some compressed format not
supported by Mathematica. (such as MP3, WMA, etc.)

2. Assuming you are willing to get down and dirty, you can import the
file using BinaryReadList. This may not be easy. Here is a sample view
of how the raw binary data is structured:

Here's what the structure of a sample AVI file looks like:

RIFF 'AVI '            Audio/Video Interleaved file
    LIST 'hdrl'        Header LIST
        'avih'         Main AVI header
        LIST 'strl'    Video stream LIST
            'strh'     Video stream header
            'strf'     Video format
        LIST 'strl'    Audio stream LIST
            'strh'     Audio stream header
            'strf'     Audio format
    LIST 'movi'        Main data LIST
        '01wb'         Audio data
        '00dc'         Video frame
    'idx1'             Index

(* Source: *)

Bottom line: While I have no problem tinkering with simple examples of
RIFF-headed binary data (such as WAV files), this personally looks
like a good way to waste *significant* time and *achieve nothing*. I'd
advise you to download a simple/cheap (probably free) video/audio
editor if you want to add sound. Look me up and email me if you want
some suggestions.


  • Prev by Date: ParametricPlot (and its derivatives) and Manipulate
  • Next by Date: Re: How does Plot work?
  • Previous by thread: AVI with sound
  • Next by thread: Fragmenting a Rectangle