Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pixel data back into movie?



hello,

i've been reading through the archives, and trying to piece
together how to access frames, change the pixel data, and
stuff them back into a playable & savable movie.

i've run into a few problems that i've been banging my head
against, listed below. i would very much appreciate any help
that you can give, sorry if these questions are too simple. :)

thanks!

*
jocelyn


1. using this gives me a sample every millisecond. this shouldn't be the case,
particularly when origMedia.getTimeScale() gives me 30. (from FrameStepper)


timeflag = StdQTConstants.nextTimeMediaSample;
timeinfo = origTrack.getNextInterestingTime(timeflag, currTime, rate);
pictSample = origTrack.getPict(currTime);
currTime = timeinfo.time;


2. i can't seem to get the pixels into the new movie correctly. the movie i get is
blank. i tried using csequence and compressing the encoded image back in, but
i'm probably going about this the wrong way. this was pretty much borrowed from
the summer discussion on image sequences.

parsedTrack = parsedMovie.addTrack(width,height,0);
parsedMedia = new VideoMedia(parsedTrack, timescale);
parsedMedia.beginEdits();

//**code to grab a Pict from a sample, alter the pixels in pixmap to get RawEncodedImage rawFrame**

//i do the below for each sample
QTHandle handle = QTHandle.fromEncodedImage(rawFrame);

CSequence seq =new CSequence (gw,
rect,
pixmap.getPixelSize(),
StdQTConstants.kAnimationCodecType,
CodecComponent.bestFidelityCodec,
StdQTConstants.codecNormalQuality,
StdQTConstants.codecNormalQuality,
1, //1 frame
null, //cTab,
0);
ImageDescription desc = seq.getDescription();
CompressedFrameInfo info = seq.compressFrame(gw,
rect,
StdQTConstants.codecFlagUpdatePrevious,
rawFrame);
boolean isKeyFrame = info.getSimilarity() == 0;
parsedMedia.addSample(handle,
0, // dataOffset,
info.getDataSize(),
frame_duration, // i've been checking, and the duration is always a 1
desc,
1, // one sample
(isKeyFrame ? 0 : StdQTConstants.mediaSampleNotSync) ); // no flags

//** then after parsing all the frames ***

parsedMedia.endEdits();
parsedTrack.insertMedia(0,0,parsedMedia.getDuration(),1);

//**code here to play the new video **//
MovieController controls = new MovieController(parsedMovie);

p.s. i'm running this on a windows2000




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.