[Libav-user] Timestamping a live video feed with variable framerate

abhishek bansal discover.ab at gmail.com
Fri Oct 5 07:42:09 CEST 2012

Hi all,

I am very sorry that I mistakenly sent incomplete mail previously.. please
ignore my previous mail !!

This is my first time with ffmpeg library. I am trying to encode a live
video feed which is coming from frame-grabber cards. This feed is having
variable frame rate and i have no control over it. Feed is captured using
Directshow's ISampleGrabber interface. Now when i try to encode this feed
using ffmpeg library my resulted video play back is either very slow or
very fast. I searched over internet and i suspect that I can control them
using timestamps. I am setting timestamp when i get frame from directshow
filter as per following code

           _startTime = _lastTime;
            _lastTime += CRefTime(pvi->AvgTimePerFrame);
            pSample->SetTime( (REFERENCE_TIME *)&_startTime,
(REFERENCE_TIME*)&_lastTime );

Now i want to use same timestamp while recording in ffmpeg.
My question is
can i use same timestamp in ffmpeg recording ?
how can I achieve that ?

right now if i use
  frame->pts = timestamp;
before avcodec_encode_video()  than av_write_frame() return negative value.
And recording does not happen. timestamp is __int64 type.

Thanks & Regards,

Abhishek Bansal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20121005/6c6953df/attachment.html>

More information about the Libav-user mailing list