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

Strahinja Radman dr.strashni at gmail.com
Wed Oct 3 15:36:53 EEST 2018


In my experience, only after the decoding of an audio frame one can tell what the number of samples for audio actually is. 
One can guess based on the codec, but that is not very reliable.

From: Yurii Monakov
Sent: 03 October 2018 09:58
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.
Subject: Re: [Libav-user] How to determine frame sizes in msec

Bob, you can simply multiply number of samples and audio time_base.

Yurii

вт, 2 окт. 2018 г. в 18:15, Bob Kirnum <bkirnum at gmail.com>:
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
_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181003/13720553/attachment.html>


More information about the Libav-user mailing list