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?
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