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

Alexandre FERRIEUX - FT/RD/SIRP/ASF/SOFTL alexandre.ferrieux
Thu Jan 15 15:06:48 CET 2009

Luca Abeni wrote:
>          - bitstream with 0000 but no payload header
> I do not know the H.263 bitstream format, but if I understand well the
> third option looks the correct one. Basically, you should return a
> valid H.263 bitstream (removing the RTP payload header and adding back
> the parts that have been removed during the RTP packetisation).
>> (and similar question for follow-ons).
> In the follow-on the RTP packetiser does not remove any byte from the
> bitstream, right? So, I think you should just remove the two bytes
> of the payload header without adding anything to the bitstream.

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).

So I suspected the decoder wanted whole pictures, by symmetry with what 
I saw on the other side (the rtp-sender is fed with whole picts in 
H263). So I used Ronald's trick with a flag bit to pass the M bit, 
buffered subsequent payloads of the same picture, and flushed on the M bit.

This works in that the decoder no longer complains about bad picture 
starts. However, it seems to go to a sink, because "-dump -hex" shows 
nothing, nor does it create an output file when started with:

./ffmpeg -dump -hex -i /tmp/video/h263.sdp out.avi

(my sdp file works, since I got the above errors)

Sorry to ask for review of my newbie code, but do you see the flaw in 
the following:

  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 */
		memcpy(data->buf+2, buf+2, len-2);

	if (flags&RTP_FLAG_M_BIT) /* M bit in RTP header */
	return 0;


More information about the ffmpeg-devel mailing list