avi file writer+basic java questions


    May 21 2006 | 12:10 am
    hello,
    I'm currently trying to make something like jit.qt.record but for writing uncompressed avi files with alpha channel, to avoid unnecessary disk fragmentation and time wasting one can get with huge .mov->.avi conversions, and quirks many windows programs have when they have to deal with quicktime.
    I've found .avi specifications+some java programs writing avi files, and it seems to be easy to construct such a file, no problems with that. I'm concerned with the following:
    does jit.avi.record already exists?
    and java related:
    how long is long? - it seems that my files would be more than 4gb, which is more than 32bits.
    and jitter+java related:
    in copyVectorToArray of JitterMatrix, what is 'dim - the dimension of the vector to copy'? - I'll need and int[] array containing 4-plane char jit.matrix data, should this 'dim' be width*height? or should i just ignore this, and set it to 0 like in jitvectorprocess.java?
    thanks, nesa

    • May 22 2006 | 7:10 pm
      On May 20, 2006, at 5:10 PM, nesa wrote:
      > > does jit.avi.record already exists?
      Not to my knowledge. Sounds great though.
      > and java related: > > how long is long? > - it seems that my files would be more than 4gb, which is more than > 32bits.
      A long in Java is 64bits:
      > and jitter+java related: > > in copyVectorToArray of JitterMatrix, what is 'dim - the dimension > of the vector to copy'?
      The dimension across which to copy (i.e. 0 is a row, 1 is a column, 2 would be a vector across depth).
      > - I'll need and int[] array containing 4-plane char jit.matrix > data, should this 'dim' be width*height? or should i just ignore > this, and set it to 0 like in jitvectorprocess.java?
      This would be 0 for rows, and it doesn't span around rows, though in 1.6, there's also a new method or copying to/from an entire matrix to a large 1D array (sorry the javadoc hasn't yet been updated for 1.6), but at the bottom, there's raw javadoc. You might also consider copying to a BufferedImage if you've already found code which works with BufferedImage Data (JitterMatrix.createBufferedImage()).
      /** * copies a matrix into an int array. * The elements of the matrix are read out in row-major order with planes multiplexed. * A higher-dimensional matrix will populate the array in 2D slices. * float32 and float64 matrices will be cast to int. * The array parameter must have exactly the same number of cells as the matrix. * @param data the integer array to populate * @return the number of elements from the matrix that were copied to the array */ public native int copyMatrixToArray(int data[]); public native int copyMatrixToArray(float data[]); public native int copyMatrixToArray(double data[]);
      /** * copies an int array into a matrix. * The elements of the matrix are written out in row-major order with planes multiplexed. * A higher-dimensional matrix will be populated by the array in 2D slices. * data will be cast to the format of the matrix. * The array parameter must have exactly the same number of cells as the matrix. * @param data the int array to populate the matrix from * @return the number of elements from the array that were copied to the matrix */ public native int copyArrayToMatrix(int data[]); public native int copyArrayToMatrix(float data[]); public native int copyArrayToMatrix(double data[]);
      Hope this helps.
      -Joshua
    • May 28 2006 | 10:13 am
      > Hope this helps.
      you bet it does! thanks for java datatypes site, that exactly what i was looking for.
      i've been fiddling with jmf, but unfortunately i've just wasted time: can't get it to export alpha channels properly, and it definitely can't create avi 2.0(>1gb) so it sucks. it seemed a bit slow and memory-hungry too. i guess it's time to install visual c++ express:)
      best, nesa