MPEG4 from Raw RTP Payload

Ok, I got the following problem:

  • I have an IP camera that can transmit MPEG4 data over RTP

  • I can connect to this camera via RTSP

  • I can receive raw RTP data.

So what's my problem now?

1. Data extraction

What is the data I really want? I know what I need to stream RTP Header

- but is there anything else I need to strip out of the packets RTP

?

2. Batch printing mode

I read that in mine SDP

I should expect a field Packetization Mode

- well, not there. Does this mean that I have to accept some kind of standard batching mode?

3. Decoding

If I understand correctly, I need to buffer all incoming frames with with Marker Bit = false

until I get frame with Marker Bit = true

to get full MPEG4 Frame

. What exactly should I understand MPEG4 Frame

? Keyframe + data until next keyframe?

4. Decode

Do I have any further data decoding? In other threads, I've seen people using a different decoder, but what else is left to decode? I mean, the camera needs to send the data already MPEG4

encoded?

5. Libraries

If I really need to decode the data, are there any open source libraries I could use to do this? Or maybe there is even a library that has some functionality where I can just dump my RTP data and then the magic happens and I get my mp4. (But I assume nothing like this will happen.)

Note. Everything I want to do has to be part of my own application, that is, for example, I cannot use external data analysis software.

In short, I really need some kind of step-by-step explanation of this. I know this is a broad question, but I don't know anymore. I also looked at RFCs

, but I haven't been able to extract much information from them.

Also I have already covered these two questions:

How to handle raw UDP packets so that they can be decoded with a decoder filter in a direct filter source

Extract MPEG4 from RTP payload

But the long answer from the first question could not understand everything for me.

UPDATE: Ok, I reported a little further and now I don't know where to look. It seems like all things bundling, etc. Not really needed for my purpose. I also recorded a stream with openRTSP . When I open these files in a Hex editor, I see that there are 16 bytes that I cannot identify, and then a config

part SDP

. Then the frame starts with normal 00 00 01 B6

. It also oprenRTSP

adds some sort of tail in MP4

- well, I really don't know what I need, and something like "extra" things that are optional.

+3


source to share


1 answer


I know I need to broadcast the RTP header - but is there anything else I need to strip from the RTP packets?

The RTP package can have material data from a file format (like MP4) or it can be based on RFC 3640 or something similar. You need to find out.

What exactly do I need to understand with MPEG4 Frame? Keyframe data + until next keyframe? Should I decode the data further? In other threads, I've seen people using a different decoder, but what is left to decode? I mean the camera needs to send data already MPEG4 encoded?



You must learn the basics of MPEG compression to fully appreciate it. Depacketising only gives you a string of bits. This is compressed data. You need to decompress it (decode) to see it on the screen.

Are there any open source libraries I could use to do this?

try ffmpeg or MPEG4IP

+1


source







All Articles