[Libav-user] How to determine frame sizes in msec

Bob Kirnum bkirnum at gmail.com
Tue Oct 2 18:15:15 EEST 2018


We are using the libavformat APIs in order to support various containers
including WebM, MKV, MP4, and MOV.  We do not use libavcodec APIs for
encoding or decoding, we have our own implementations.  Our implementation
is a real-time media server which can play from or record to these
containers.  We also offer DVR like controls for skipping ahead or behind.
I am having some difficulty finding a consistent implementation for all
containers to determine the frame times for the audio and video frames we
read.  When using some MP4 files, the cur_dts value is always
AV_NOPTS_VALUE so this can't be used.  When playing some MKV files, the
audio and video codec context time_base values are inconsistent.  For video
the time_base is (1001 / 24000) which can be used to determine the frame
rate and duration (23.976 fps or 41.7 msec).  However, the audio values are
(1 / 8000) which is the sample rate not the frame size.  It is certainly
possible that I am not understanding this correctly.  Can someone recommend
a consistent calculation that will work for audio and video in these
various containers?

Thanks,
Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181002/9a4155de/attachment.html>


More information about the Libav-user mailing list