[FFmpeg-user] Unable to sync audio and video

Nicolas George george at nsup.org
Sun Feb 28 17:41:28 EET 2021


Livio Tenze (12021-02-23):
> I am following your suggestion. I added one thread to acquire the audio
> stream. Currently I have only the thread for the audio stream; I will
> implement threads also for video acquisition.
> The see a strange behaviour:
> ===============================================
> Crop frame system is 1
> Dummy read one frame
> VIDEO PTS START from video1
> AUDIO: void AudioInputThread::startLoop()
> AUDIO: audioThread started NOW!
> PTS START video: 83565572 audio: -1
> stream v:1/15360 a:1/22050
> AUDIO: audio: 0.000 0.185759 = 0.186 1614099985303395
> set record for 15.00 minutes
> AUDIO: head 0, tail 1
> start recording
> AUDIO: audio: 1.840 0.185759 = 2.026 1614099987143524
> AUDIO: head 0, tail 2
> AUDIO: audio: 2.068 0.185759 = 2.253 1614099987371002
> AUDIO: head 0, tail 3
> AUDIO: audio: 1.735 0.185759 = 1.920 1614099987037933
> AUDIO: head 0, tail 4
> AUDIO: audio: 1.476 0.185759 = 1.662 1614099986779509
> AUDIO: head 0, tail 5
> AUDIO: audio: 1.293 0.185759 = 1.479 1614099986596620
> AUDIO: head 0, tail 6
> AUDIO: audio: 1.116 0.185759 = 1.302 1614099986419398
> AUDIO: head 0, tail 7
> video1: 0.032 83597620 33333
> >>> video timer0 0
> >>> video timer1 20
> ===============================================
> Please, take into account lines starting with "AUDIO: " tag.
> This is a log of my application. I notice that the audio estimated position
> (it is estimated taking into account the first received pts) starts
> increasing, then decreases, and, after some packets, the behaviour is
> monotonic and right. Moreover, the distance from the starting PTS and the
> second one is almost 2 seconds.
> Have you any suggestions about this strange behaviour?

I am sorry, but I do not think I can help with that: I have no idea what
these numbers are supposed to mean.

In the meantime, I notice that you have not checked if you had buffer
overruns in ALSA, and that you have not determined the origin of your
timestamps.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210228/10d5895d/attachment.sig>


More information about the ffmpeg-user mailing list