[Libav-user] Seeking, timestamps, AVFrame, AVStream

Robert Krüger krueger at lesspain.de
Mon Sep 16 09:28:55 CEST 2013


On Sun, Sep 15, 2013 at 11:37 PM, James Board <jpboard2 at yahoo.com> wrote:
> I'm writing a libAV application in C, and I'm trying to use the
> av_seek_frame() or avformatseek_file() to move within the video stream.
> Ideally, I'd like to seek to frame number N.  I'd like a subroutine that
> seeks
> to frame number N, but I think from previous discussions, that isn't the way
> things are done in ffmpeg and libav.  Okay.
>
> I'm trying to understand how things actually are done in ffmpeg/libav.  When
> decoding a video file (all my files, for now, are AVI containers with no
> compression, or ffvhuff compression), the AVFrame struct has several
> members:
>     pts
>     pkt_pts
>     pkt_dts
>     coded_picture_number
>     display_picture_number
>     best_effort_timestamp (the name of this one really worries me)
>     pkt_pos
>     pkt_duration
> What do those all mean?  Can I use those to figure out which frame this is?
>
> Also, AVStream has some members:
>     pts (has 3 components)
>     timebase (2 components)
>     start_time
>     duration
> What do they mean?
>
> I have test code and the only thing that seems useful to me is that pkt_pos
> seems to increase by a very large value for each frame (over 4 million) and
> the it
> is usually the same difference between two frames, but not always.
>
> Anyway, can someone tell me what the above struct members mean, and how I
> can
> use them to tell where each frame is in the overall video file?  Thanks.
>

Try looking at the documentation in the header files, in this case
avcodec.h. It should help you quite a bit.


More information about the Libav-user mailing list