Yes, I started looking at that. I also downloaded some H264 reference utilities that someone at Dolby put together. It seems that you must start scanning the mpeg stream for a Sequence Parameter Set with a NAL Access Code of 7. At first glance this doesn't appear too bad, as the code is already in src/demuxers/demux_mpeg_pes.c to scan for a NAL code of 9 (Access Unit Delimiter), which it uses to detect the presence of H264 stream. I thought it would be quite straightforward to find the NAL code of 7 and then parse the SPS and in turn find the height and width parameters. However, trying to get this to work in sequence is not that easy as the parse_video_stream seems to want to identify MPEG1/2 or H264 and then just init the decoders. This is where the initialisation of CoreAVCDecoder.ax is made, currently with the hardcoded video size of 1920x1080. What I want it to do is identify the H264 stream and then keep scanning for an SPS to identify the size prior to initting the decoder. It seems that once it's found the AUD it doesn't really want to keep looking for a SPS. I tried modifying the code to look for a SPS to init the H264 sequence, however haven't had much success with that either. It might be the case that the whole initialisation of the CoreAVC decoder would be better suited somewhere else in the code.... :-\ Still, I knew nothing about MPEG2 and MPEG4 formats this morning and now I know a tiny bit! Unfortunately, I'm not sure if I have the coding skills to be able to finish the job.. :-( On Jan 24, 2008 7:31 PM, Reinhard Nissl <rnissl@xxxxxx> wrote: > Hi, > > Morfsta schrieb: > > > > OK, I have added the following code into src/demuxers/demux_mpeg_pes.c > > > > static int32_t GetVideoSize(const uint8_t *buf, int length, int > > *width, int *height) > > { > > int i = 0; // the minimum length of the video packet header > > //i += buf[i] + 1; // possible additional header bytes > > for (; i < length-6; i++) { > > if (buf[i] == 0 && buf[i + 1] == 0 && buf[i + 2] == 1) { > > if(buf[i + 3] == 0xb3) { > > int d = (buf[i+4] << 16) | (buf[i+5] << 8) | buf[i+6]; > > *width = (d >> 12); > > *height = (d & 0xfff); > > return 1; > > } > > } > > } > > return 0; > > } > > > > and then put the following code in parse_video_stream: - > > > > int Width, Height; > > if (GetVideoSize(p, payload_size, &Width, &Height)) { > > printf("Detected video size %dx%d\n", Width, Height); > > } > > else { > > printf("Failed to detect video size\n"); > > } > > > > before: /* H.264 broadcasts via DVB-S use standard video PES packets, > > > > This detects the video size for MPEG2 broadcasts (Detected video size 704x576 > > ), but not for H264, I'm guessing the payload is in a different > > format. Can anyone point me in the direction of a GetVideoSize type of > > function for H264 (I looked in libavcodec and the code looks a bit > > more complex!), or spot what I am doing wrong here? > > In H.264, this information in coded far more complex. Have a look > into VDR's h264parser.c. Look for pic_width_in_mbs_minus1, > pic_height_in_map_units_minus1 and frame_crop_*_offset. > > You can get the standard from here for free: > http://www.itu.int/rec/T-REC-H.264-200503-I/en > > Bye. > -- > Dipl.-Inform. (FH) Reinhard Nissl > mailto:rnissl@xxxxxx > > _______________________________________________ > > vdr mailing list > vdr@xxxxxxxxxxx > http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr > _______________________________________________ vdr mailing list vdr@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr