[FFmpeg-devel] RTP mark bit not passed to parse_packet

Luca Abeni lucabe72
Thu Jan 15 15:33:43 CET 2009


> OK I followed your advice, and it partly works :)
> "Partly", because passing the raw bitstream as is (ie one AV packet per 
> RTP packet, after taking care of the headers as specified above), yields 
> complaints from the decoder (Bad picture start code...header damaged).
Did you set st->need_parsing = AVSTREAM_PARSE_FULL?
Can you try something like "ffmpeg -i h263.sdp -vcodec copy out.263"
and check if "out.263" is a valid H.263 bitstream?

> So I suspected the decoder wanted whole pictures
Yes, the decoder wants whole pictures, but there is a "parser" between
the demuxer and the decoder, and the parser transforms the bitstream in
a sequence of frames (AFAIK).

Check what the MPEG1VIDEO de-packetiser does: if a frame is split in more
packets, it returns only a part of the frame.

I expect to see the decoder complaining at the beginning of a stream, but
then it should work...

>   static int h263_handle_packet(PayloadContext *data,
>                                AVStream *st,
>                                AVPacket * pkt,
>                                uint32_t * timestamp,
>                                const uint8_t * buf,
>                                int len, int flags)
>   {
> 	if(buf[0] & 0x04) /* P bit in H263 payload header */
> 	  {
> 		data->buf[0]=0;
> 		data->buf[1]=0;
> 		memcpy(data->buf+2, buf+2, len-2);
> 		data->pos=len;
> 	  }
> 	if (flags&RTP_FLAG_M_BIT) /* M bit in RTP header */
> 	  {
> 		av_new_packet(pkt,data->pos);
> 		memcpy(pkt->data,data->buf,data->pos);
> 		data->pos=0;
> 	  }
> 	return 0;

I suspect the problem here is that if M is not set you return 0
(which means "packet is returned"), but you do not put anything
in AVPacket.


More information about the ffmpeg-devel mailing list