|
From: <pv...@un...> - 2002-12-05 15:59:03
|
Hi,
Hi,
I am trying to get a small example going to decode frames from a
quicktime movie. I have tried to create a JPEG-encoded video and I am
now trying to extract the frames from the movie. I am not sure the
creation of the movie succeeded, but I cannot read any other movie
available at the project website.
I ahve included part of the source code tor ead a frame, although no
values appear in the buffer. Wahat is the right way to extract the
values from the "decompress_row" buffer ?
unsigned char **decompress_row = NULL, **transfer = NULL;
RGB *clr = NULL; /* RGBA */ ...
video_width = quicktime_video_width( ( quicktime_t *)filmptr, n_video
);
video_height = quicktime_video_height( ( quicktime_t *)filmptr, n_video
);
video_rate = quicktime_frame_rate( ( quicktime_t *)filmptr, n_video );
video_pos = quicktime_video_position( ( quicktime_t *)filmptr, n_video
);
decompress_row = ( unsigned char **)malloc( video_height * sizeof( char
*) );
if( !decompress_row ){
sprintf( errbuf, "Could not allocate frame row buffer" );
status = IE_NOT_OK;
}
transfer = decompress_row;
quicktime_reads_cmodel( ( quicktime_t *)filmptr, BC_RGBA8888, n_video
);
clr = ImageOutData( img );
for( i = 0; i < video_height; i++ ) {
decompress_row[i] = ( unsigned char *)clr + i * video_width * 4;
}
quicktime_decode_video( ( quicktime_t *)filmptr, BC_RGBA8888,
decompress_row, n_video);
for( y = 0; y < video_height; y++ ){
for( x = 0; x < video_width; x++ ){
Red( clr ) = *transfer[y]++;
Green( clr ) = *transfer[y]++;
Blue( clr ) = *transfer[y]++;
Extra( clr ) = *transfer[y]++;
printf( "%d\t%d\t%d\t%d\t%d\n", x, y, ( int )Red( clr ), ( int
)Green( clr ), ( int )Blue( clr ) );
clr++;
}
}
Best regards,
Peter Van Osta
Union Biometrica N.V./S.A.
European Scientific Operations (ESO)
Cipalstraat 3
B-2440 Geel
Belgium
tel.: +32 (0)14 570 619
fax.: +32 (0)14 570 621
http://www.unionbio.com/
http://ourworld.compuserve.com/homepages/pvosta/cvwww.htm
|