[Libav-user] rtp h264 stream too fast

adreas Polyxronopoulos apolyxrono at yahoo.co.uk
Mon Nov 14 15:52:58 CET 2011

So you mean to change the decoder side which in my case is the mplayer right ? 
The total duration of the stream after starting the muxing.out(my executable) is about 7sec, but using the ffmpeg-command is around 52.6 sec. I think the problem is in the encoder-streamer side not at the decoder side, correct my if  i am wrong. I am calculating the PTS as follows:

struct timeval  tv;

        struct timezone tz;
        struct tm      *tm;
        gettimeofday(&tv, &tz);
        tm = localtime(&tv.tv_sec);
        int now = tm->tm_hour * 3600 * 1000 + tm->tm_min * 60 * 1000 + tm->tm_sec * 1000 + tv.tv_usec / 1000;
        picture->pts = av_rescale_q(now, (AVRational){1, 10}, c->time_base);

 thanks a lot for the reply.

Adreas Polychronopoulos

From: Alex Cohn <alexcohn at netvision.net.il>
To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <libav-user at ffmpeg.org>
Sent: Monday, 14 November 2011, 16:13
Subject: Re: [Libav-user] rtp h264 stream too fast

> 2) The duration of the file is 52.6 sec (526 total frames @ 10 fps),  in the
> above ffmpeg command the -re option forces ffmpeg to read the file in native
> frame rate at 10fps. How can i do this from my source code ? Should i
> implemented and how ? Is there any value to set in any libav structure ?
> thanks in advance
> andreasP

To the best of my knowledge you can get the pts values for decoded
frames, or you can estimate them from frame number and the expected
FPS (in your case, you don't have to worry about variable frame rate
and other exotics). From this pts you determine how long to sleep
between calls to decode_video or render.

Good luck,
Libav-user mailing list
Libav-user at ffmpeg.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111114/ecfc57ee/attachment.html>

More information about the Libav-user mailing list