Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we extract the RTP packet sequence number from AVPacket (ffmpeg)

Tags:

ffmpeg

rtp

packet

We are trying to extract the "Sequence Number" from the RTP header of a packet. We use av_read_frame in order to read the packets into AVPacket structs.

We tried using the AVPacket.data field, hoping it holds the original payload, but we didn't manage to find the right location of the header. So we assume that the data field does not hold the full payload - please correct if we are wrong.

Is there a way to find the RTP header information?

like image 879
Nech Avatar asked Nov 17 '15 10:11

Nech


1 Answers

Use RTPDemuxContext, it contains the RTP header info, after reading a frame
To access it use the AVFormatContext you used when you opened the stream

AVPacket* packet;
av_read_frame(formatCtx, packet);
RTSPState* rtspState = formatCtx->priv_data; 
RTPDemuxContext *rtpdemux = rtspState->rtsp_streams[packet->stream_index]->transport_priv;
like image 196
Nech Avatar answered Oct 15 '22 22:10

Nech