I have series of encoded packets, H.264 video and AAC audio. As they're coming on, I'm writing them to a video file, using av_write_frame.

Given the following situation in a row

  • 10 seconds of video, then
  • 10 seconds of video and audio, then
  • 10 seconds of video.

Everything muxes fine and when played back via VLC or QuickTime, everything looks good. If I play it in Windows Media Player, the audio is played immediately.

It seems I'm doing something wrong, but checking the PTS of the audio stream packets, they are set to 10 seconds based on the time base of the audio stream.

有帮助吗?

解决方案

It seems that it's best to inject empty audio packets at the beginning of the stream. This is the only way that video playback in WMP would work. Every player handles the streams differently and this is the best way to ensure compatibility across players.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top