0
votes

I was writing a program that could pack RTP header before h264 & aac. but I was confused with RTP timestamp field.

If the video codec is h264, the timestamp could be added by 90000/fps with each frame. I have no idea about the aac.

My aac sample rate is 8000HZ,config=1588 and each frame is 250 ~ 520. I found some solution :

(1) 1024

(2) 8000/1024 = 7 => 8000/7 = 1142

Video and audio could not sync, the video will faster than audio.

Anyone could help me?

1
Are you packing Audio payload ( AAC) and Video Payload ( H.264) in the same RTP packet or sending them separately, in different RTP packet ? what are the RFC you are following. - mail2subhajit
I sent then in seperate rtp packet. RFC 6184 for H264 and RFC 3640 for mpeg4 audio(aac) But I could not find the formula to calculate the timestamp for packing audio, I found some solution from website, like stack overflow or github. - BY.H

1 Answers

0
votes

Sending/Transmitting of Packing RTP packets

H.264 @ 90000 - rtp timestamp = frame timestamp * 90000 (timestamp of the frame when read from any source)

AAC @ 8000 - rtp timestamp = buffer timestamp * 8000 (timestamp of the audio buffer when read from any source)

Receiving of unPacking RTP packets

H.264 - actual timestamp = rtp timestamp / 90000

AAC - actual timestamp = rtp timestamp / 8000

Based of the actual timestamp you do the Audio Video synchronization.

Note: convert the time to seconds from milliseconds