[Live-devel] Adding secondary audio track to existing H264 RTP stream

Marcin marcin at speed666.info
Wed Mar 28 06:41:45 PDT 2018


Hello Ross,
I try to use your library to do something different. I got an RTSP input 
source with only video track (40ms PTS diff, 25 fps, H264)
I need to add an audio track with AAC (from local file) and mux it 
together in TS.
The problem is that as i recieve video NAL unit every 40ms at *almost* 
one packet every 40ms, reading from file needs to have every ADTS packet 
every 21.3 ms (1/48000) * 1024 samples * 1000us).
How to read this file in native speed (read every packet every 21.3ms) 
using ADTSFileSource?
Using scheduleDelayedTask every 21.3 ms to get new packet on time is bad 
option - that was wrong approach - took a lot of CPU.
I dont care about synchronizing exact points in time (lip-sync) because 
it's music and drifting about 300ms at the end is acceptable.
Can you point me a little how to do this? Now i use DummySink to get 
videoframes.
Marcin Wozniak
Intermania.pl



More information about the live-devel mailing list