0

After looking into the documentation, AVStream.pts has been deprecated. Before I was using this loop to try and get the video and audio time. it's the same as whats in the api-example.c (which no longer works):

if (audioStream_)
    {
        VideoTime = (double)videoStream_->pts.val*videoStream_->time_base.num/videoStream_->time_base.den;
        do
        {
            AudioTime = (double)audioStream_->pts.val*audioStream_->time_base.num/audioStream_->time_base.den;
            ret = WriteAudioFrame();
        }
        while (AudioTime < VideoTime && ret);
        if (ret < 0)
            return ret;
    }

what is the current alternative? I haven't been able to get anything to work as of yet and I've been searching for around 3 hours.

1 Answers1

1

According to doc/APIchanges:

2014-05-19 - 999a99c / a312f71 - lavf 55.38.101 / 55.17.1 - avformat.h
Deprecate AVStream.pts and the AVFrac struct, which was its only use
case. Use av_stream_get_end_pts().

I don't know where you got api-example.c, but that has been moved to doc/examples/decoding_encoding.c (I'm referring to code from the current git master branch).

llogan
  • 121,796
  • 28
  • 232
  • 243
  • I've found the encoding_decoding.c but it doesn't talk about how to interleave the audio/video from what I can tell. Am I missing something? I got it from https://libav.org/download.html 2 weeks ago. the libav V10 "Eks" – Narayana James Emery Nov 23 '14 at 21:55
  • Oh, you're using libav (the fork, while I assumed you meant libav* the libraries from FFmpeg). I don't know anything about this fork. I wish people wouldn't use the [tag:ffmpeg] tag for forks, and I wish this fork didn't use such a damned confusing name. – llogan Nov 23 '14 at 21:57
  • ah, I see what you mean, sorry, I can take the tag off. – Narayana James Emery Nov 23 '14 at 22:02
  • You're using Libav (the fork), but referring to documentation and examples from FFmpeg. Additionally you're probably mixing information and examples from API incompatible versions. – llogan Nov 23 '14 at 22:03
  • I see what you mean, sorry about that, I'll clean it up a bit. new to libav – Narayana James Emery Nov 23 '14 at 22:06