[vlc] H263 over RTP

chris.2.dobbs at bt.com chris.2.dobbs at bt.com
Tue Mar 6 13:21:27 CET 2007


All,
If anyone is interested I have managed to get VLC to playback file based
H263 video remotely over RTP (as a non-encapsulated elementary stream).

I had trouble getting this to work as I couldn't figure out how to
transpose the file based H263 records into RFC4629 RTP packets. I
finally managed to reverse engineer to live555 code (which includes an
H263 streamer module) and this is what u have to do:

Many thanks to Ross Finlayson BTW who prodded me in the right direction
several times...

The following does not detail all the RTP field setups as they are not
crucial to getting this to work, things like sequence number and time
stamps are taken as read...

1. Read 5 bytes first (from file based H263 data) , this gives you a
starting frame of reference.
    Create 1st RTP packet and set the M bit to 1
    Create and add to RTP payload the 2 byte H263 header and set the P
bit to 1 (zero rest out)
   
    copy the 5 byte record  into the RTP payload body (after the H263
header).
 
    Send it 

2. Read as much as u can from file without blowing your MTU , in my case
this is 1500 so I chose 1436 (like the live555 code)

    Create new RTP packet + new 2 byte H263 header
    Scan newly read in H263 record for occurance of end of frame marker
- this is two consectutive bytes of zeros (00 00).
	
    pseudo code follows:

     IF eof frame marker found:
               This record contains an end of frame so set the RTP M bit
to 1 and  set the H263 header P bit to 0, then copy to RTP payload
(after H263 header) 
	    the record data  up to but NOT including the "0000". Store
remainder in temp.
	    The next record read will therefore be a new start of frame.

    IF eof frame marker not found:
               IF previous record read contained an end of frame marker
                           prefix the this packet with any remainder
stored in temp and set the P bit to 1 
                           and the M bit to 0.          
                           Need to make sure at this point that we don't
blow the MTU.
               ELSE
                           Set RTP M bit to 0 and H263 P bit to 0 and
copy whole record into RTP payload(after the H263 header).
    Send it !

3. Repeat 2 until EOF


To get a remote vlc to read this stream, create an sdp file like this

 v=0
o=- 7776 3 IN IP4 10.215.130.112
s=Test H263 stream
i=Parameters for the session streamed by "ChipsAhoyH263"
t=0 0
m=video 7776 RTP/AVP 98
a=rtpmap:98 H263-1998/90000
a=fmtp:98 profile=0; level=40
b=TIAS:2048000 


Where 7776 is the port you are streaming out to from above steps.
Save as say c:\testH263.sdp

Start vlc like this:

Vlc -vvv file://c:\testH263.sdp


Start the stream and u should see video.

I guess I should have figured all this out from the various RFC's but to
actually implement was not exactly straightforward - no where could I
find info on how to look for the end of frame marker ("0000") which is
the key to the whole thing! 
Hope this helps as it drove me nuts...
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc/attachments/20070306/10f69945/attachment.html>


More information about the vlc mailing list