mxf_set_audio_pts creates incorrect PTS for compressed audio
|Reported by:||Markus P Schumann||Owned by:|
|Cc:||Marton Balint||Blocked By:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Summary of the bug:
How to reproduce: ffmpeg -i AVC_AAC.mxf AVC_AAC.mp4
MP4 output file will have incorrect timestamps, plays with A/V sync issues and scrubbing is not possible.
The bug is in mxf_set_audio_pts.
FFMEPG uses the element size (KLV) to keep a cumulative count and uses the count as PTS.
For PCM audio the element size is proportional to the sample count – for compressed audio (like AAC) it is not.
So - FFMPEG MXF audio PTS calculation works only for PCM correctly.
I verified my assumption by fixing FFMPEG MXF audio PTS calculation. Now I am counting the AAC packets in the KLV and then increment PTS += AAC_frame_count * 1024;
Now the resulting transcoded MP4 files for fine.