<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang=EN-GB link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal>In my experience, only after the decoding of an audio frame one can tell what the number of samples for audio actually is. </p><p class=MsoNormal>One can guess based on the codec, but that is not very reliable.</p><p class=MsoNormal><o:p> </o:p></p><div style='mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal style='border:none;padding:0cm'><b>From: </b><a href="mailto:monakov.y@gmail.com">Yurii Monakov</a><br><b>Sent: </b>03 October 2018 09:58<br><b>To: </b><a href="mailto:libav-user@ffmpeg.org">This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.</a><br><b>Subject: </b>Re: [Libav-user] How to determine frame sizes in msec</p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Bob, you can simply multiply number of samples and audio time_base.</p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Yurii</p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>вт, 2 окт. 2018 г. в 18:15, Bob Kirnum <<a href="mailto:bkirnum@gmail.com">bkirnum@gmail.com</a>>:</p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><p class=MsoNormal>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?</p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks,</p></div><div><p class=MsoNormal>Bob</p></div></div></blockquote></div><p class=MsoNormal style='margin-left:4.8pt'>_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br><a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>