[Libav-user] FPS in mkv

PaweĊ‚ Kopalko pawel.kopalko at gmail.com
Tue May 23 16:51:26 EEST 2017

Hi all!

I'm muxing H264 frames with alaw audio frames coming from the RTP stream
but I'm having some problems with setting fps for the mkv container.

For the AVPacket::pts I am using the calculated presentation time (from
RTCP SR reports)
I am rescaling them as follows ( I had assumed exactly the same for audio):

pkt.pts  = av_rescale_q(s_video_sync.fSyncTime.tv_sec * 1000000 +
s_video_sync.fSyncTime.tv_usec, av_encode_codec_ctx->time_base,

* the timestamp in the end is in microseconds (the first parameter)
* av_encode_codec_ctx->time_base is set to  {1,fps} where fps is depending
on the stream, let's say 5
* video_st->time_base is auto seto to {1,1000} (I gather that this is
forced by mkv container)

I gather that this is what should be set to te rescale function (at least
that's what examples show), but the ffprobe show strange readouts for
duration and fps is set to 1k... and well the video plays strangely.

my question is how should I approach this?
Should I rescale the timestamp to start counting from 0 for the first
packet, or I'm messing two different time domains and thus muxer can't
figure out what to do?

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

More information about the Libav-user mailing list