[Ffmpeg-devel] av_seek_frame() issues with audio from MPEG-TS

Andy Brown abrown
Wed Dec 7 12:54:08 CET 2005

I will try today with a video frame that is further into the file.  However
I do know that this is not the first audio frame.  The video PTS is
0x110362B4.  The first audio PTS is 0x1102BE7A.  In fact, if I hardcode the
PTS to search for (instead of the video PTS) to say 0x11029999 it will
return for me the audio frame with a PTS of 0x110323BA.  So I know there are
audio frames with earlier PTS's and I know that the av_seek_frame() can
return these frames.  Strangely enough, if I instead hardcode the PTS to
0x11030000 the returned audio PTS will now jump to 0x110388FA.

One thing I failed to mention before is that the time_base for the audio and
video is the same:
 num = 1
 den = 0x15F90

which matches the 90kHz reference clock of the MPEG PTS.

Also both streams have exactly the same start_time: 0xBD020B84


-----Original Message-----
From: Wolfram Gloger [mailto:wmglo at dent.med.uni-muenchen.de]
Sent: Wednesday, December 07, 2005 4:05 AM
To: ffmpeg-devel at mplayerhq.hu
Subject: Re: [Ffmpeg-devel] av_seek_frame() issues with audio from


> I begin by finding the first video key frame
> with a PTS that is not AV_NOPTS_VALUE.  This will be my starting point of
> playback for my new output stream.  Now I need the audio to align up
> so that it starts precisely when the video starts.  My idea was to take
> PTS of the video (no decoding yet so I'm still working with the AVPacket
> container) and make a call into av_seek_frame() to grab the audio frame
> either starts exactly when the video frame does or just before it.
> What I find is that the av_seek_frame() returns an audio frame with a PTS
> greater than that of the video (by many audio frames in duration).

Does this only happen at the start of the file?
Can you check that it also happens when you first seek to somewhere
within the TS file?
I.e., could it be that there simply _are_ no audio frames with a
PTS earlier than your initial video frame.


ffmpeg-devel mailing list
ffmpeg-devel at mplayerhq.hu

More information about the ffmpeg-devel mailing list