Search code examples
ffmpegsmooth-streaming

Concatenating Smooth Streaming output to a single MP4 file - problems with A/V sync. What is CodecPrivateData?


I have a video in fragmented form which is an output of an Azure Media Services Live Event (Smooth Streaming).

I'm trying to concatenate the segments to get a single MP4 file, however I've run into a A/V sync problem - no matter what I do (time-shifting/speeding up/slowing down/using FFmpeg filters), the audio delay is always floating. To get the output MP4 file, I tried concatenating the segments for video and audio streams (both at OS file level and with FFmpeg) and then muxing with FFmpeg.

I've tried everything I found on the web and I'm always ending up with exactly the same result. What's important, when I play the source from the manifest file, it's all good. That made me skim through the manifest once again, and I realized there's CodecPrivateData value which I'm not using anywhere in the process. What is it? Could it somehow help solving my problem?


Solution

  • Mystery solved: the manifest file contains the list of stream discontinuities, which need to be taken into account when concatenating the streams.