[MPlayer-dev-eng] demux_mov & width/height
Michael Niedermayer
michaelni at gmx.at
Thu Mar 14 23:04:55 CET 2002
Hi
On Thursday 14 March 2002 22:07, Arpi wrote:
[...]
> > still wrong width/height for the 3 files from mphq/samples/mpeg-4
> > the correct width & height for them is 352x240 & 168x144 or something
> >
> :((
>
> Is it enough to know width/height, or do you need the whole header ?
hmm, the 3 files play fine with just the correct width & height, but it might
become tricky with more advanced features
> I can try to hack demux_mov to send mpeg header (from stsd) before the
> first frame (so at the first get_sample call you'll get header + first
> frame concatenated). Or i can make simple parser and parse out width/height
both should be ok
> from mpeg header (could you tell me its format?).
sure, but u wont like it, its actually only a small part of the mpeg4 header
mess ...
first is the 00 00 01 20 byte aligned startcode
heres the part of ffmpeg which parses the part between the startcode & the
width/height ...
/* vol header */
skip_bits(&s->gb, 1); /* random access */
skip_bits(&s->gb, 8); /* vo_type */
if (get_bits1(&s->gb) != 0) { /* is_ol_id */
vo_ver_id = get_bits(&s->gb, 4); /* vo_ver_id */
skip_bits(&s->gb, 3); /* vo_priority */
} else {
vo_ver_id = 1;
}
s->aspect_ratio_info= get_bits(&s->gb, 4);
if(s->aspect_ratio_info == EXTENDET_PAR){
skip_bits(&s->gb, 8); //par_width
skip_bits(&s->gb, 8); // par_height
}
if(get_bits1(&s->gb)){ /* vol control parameter */
printf("vol control parameter not supported\n");
return -1;
}
s->shape = get_bits(&s->gb, 2); /* vol shape */
if(s->shape != RECT_SHAPE) printf("only rectangular vol supported\n");
if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
printf("Gray shape not supported\n");
skip_bits(&s->gb, 4); //video_object_layer_shape_extension
}
skip_bits1(&s->gb); /* marker */
s->time_increment_resolution = get_bits(&s->gb, 16);
s->time_increment_bits = av_log2(s->time_increment_resolution - 1) +
1;
if (s->time_increment_bits < 1)
s->time_increment_bits = 1;
skip_bits1(&s->gb); /* marker */
if (get_bits1(&s->gb) != 0) { /* fixed_vop_rate */
skip_bits(&s->gb, s->time_increment_bits);
}
if (s->shape != BIN_ONLY_SHAPE) {
if (s->shape == RECT_SHAPE) {
skip_bits1(&s->gb); /* marker */
------> width = get_bits(&s->gb, 13);
skip_bits1(&s->gb); /* marker */
------> height = get_bits(&s->gb, 13);
skip_bits1(&s->gb); /* marker */
}
[...]
Michael
More information about the MPlayer-dev-eng
mailing list