[Ffmpeg-devel] [Ffmpeg-devel-old] rtp mpeg4 packetize problem

mike lee mikelee
Wed Jul 20 09:58:10 CEST 2005


Luca Abeni wrote:

>Hello Mike,
>On Wed, 2005-07-20 at 12:19 +0800, mike lee wrote:
>  
>
>>Dear all
>>    I am now trying to use ffmpeg library to stream data and test with
>>videolan player thought rtsp/rtp/udp .
>>    
>>
>I wrote a similar application some time ago (a very simple one,
>streaming only video).
>  
>
It is what exactly i am doing. Will you share those codes with us?

>  
>
>>But i found that error occur
>>whenever a frame is sent with multiple packets which is likely to be the
>>key frame. Final image is a mess at the bottom but ok at the top. And i
>>have checked that the marker bit is properly set on the last packet.
>>    
>>
>What I did is pretty simple, and works ok:
>1) send only 1 frame per rtp packet (no more than 1 frame)
>2) if a frame does not fit in a single rtp packet, split it in more
>packets, setting the M flag to 1 only on the last one. It is important
>that the last packet contains only the end of the frame (and not the
>beginning of the next one, for example).
>  
>
Method(1) should be ok for any non-key frame, but it is quite difficult
for key frame. Method(2) is what i am doing and videolan player seem ok
with my marker bit setting.

>This simple strategy maybe is not fully 3016 compliant, but it works ok
>(tested with MPEG4 streams up to 4Mbps). Both videolan client and
>quicktime player can receive the video stream without problems and
>without showing any artifact.
>
>Another option would be to use live.com libraries (but it seems a little
>bit overkilling, if you have to stream only MPEG4 video).
>  
>
I am now using videlan player compiled with live.com library. The
streaming should be ok, but the problem i guess should be because of the
non-standard packetize method in libavformat/rtp.c. What i get from the
coding is that rtp packet is only cut down into raw payload packet which
do not compatble to 3016 mpeg4 payload format.

>
>  
>
>>    Also, according rfc3016, mpeg4 rtp payload may include specific
>>header.
>>    
>>
>I did not double-check, but I do not remember rfc3016 asking for
>specific headers in the payload (I think it simply cites some standard
>MPEG4 headers). The only "strange thing" that you can do is to put the
>MPEG4 "global headers" in the config line in the SDP, and remove them
>from the MPEG4 video stream (use CODEC_FLAG_GLOBAL_HEADER).
>  
>
Due to lack of knowledge on mpeg coding, i do not look deep inside
libavcodec. Could you tell me the usage on CODEC_FLAG_GLOBAL_HEADER?
Will it cut off all the headers including VOL, VP,etc? How can i obtain
the global header?

Thanks a lot , Luca

Mike,Lee





More information about the ffmpeg-devel mailing list