1

I am working in a streaming project which uses MPEG2TS protocol, Currently I am facing problem in audio video synchronization.

I am using PCR calculation as

PCR_base = (system_clock_frequency * PTS(audio/video)  ) /300

PCR_ext = (system_clock_frequency * PTS(audio/video)  ) % 300

and emiting PCR at every 100ms

I am using PTS value as

PTS= (Encoded_time_stamp * 9 / 100 ) / 300

I am getting a av sync delay of -150ms(video ahead of audio) in mplayer and in VLC player I am getting only the First frame of video.

Please help me with the PCR calculation for muxing and also how to get the audio video synchronization.

Anik Islam Abhi
  • 24,324
  • 8
  • 52
  • 74

1 Answers1

0

The PCR is a clock you generate when you multiplex your stream so they can be synchronized at the demux step.

My guess is that your error is more likely to come from the PTS/DTS which are timestamps giving the moment when the decoder has to present/decode the A/V frames. It seems that your audio timestamps are a little bit late.

With no guarantee, have you tried to tweak it ?

audio_pts += 150; // in ms

Otherwise, you can use software tools to resynch your stream, like ffmpeg : have a llok at this good tutorial. Also some related S.O. posts:

Community
  • 1
  • 1
n0p
  • 3,357
  • 2
  • 26
  • 47