Sound drift when streaming
I am streaming rtmp with ffmpeg from a camera source that delivers 50fps frame rate to a matrox capture card.
until recently I have been using "vMix" in order to capture the video and release it via dshow to ffmpeg.
among other things, the "vMix" was taking the frame rate and changing it to 25fps before reaching to ffmpeg.
due to some circumstances, I tried to avoid using "vMix" and start capturing the video straight to ffmpeg from the card. in order to deal with the frame rate, I have added the command -r 25 to the ffmpeg command.
from this point on the sound has gotten out of sync while the audio was coming first.
In order to deal with that I add the commands "-async" and "-itsoffset" which corrected the initial sync issues.
The problem is that with time (the stream is 24/7) the sound is drifting further away from video to the point that after 20 hours it has a 2 sec delay, when audio is coming before video.
This is my current command:
the report looks like this:
The capture card is Matrox Mojito max and the pc is HP Z440 with windows 7.
What did I do wrong, or, what else can I try?
What is the source of the audio? I find it odd that the sample rate that ffmpeg is getting from the source is at 44100. That would suggest that the audio is not embedded in the camera video source. If that's the case you may be suffering from clock drift due to separate audio / video devices running off of separate clocks.
Hi Reuben Martin
Thanks for your reply.
The sound comes from a mic connected to a mixer/preamp that is connected back to the camera before capture card.
From the SDI capture card the sound does not drift, but only after encoding the stream.
Where then is the audio getting re-sampled to 44100? Embedded SDI audio is at 48k.
By a preamp mixer.