I am working on a project in which I am receiving raw frames from some input video devices. I am trying to write those frames in a video files using FFMPEG library. I have no control over the frame rate i am getting from my input sources. This frame rate varies in run-time also. Now my problem is how do i sync between recorded video and coming video. Depending upon frame-rate i set in FFMPEG and actual frame rate that i am receiving playback of recorded video is either fast or slow than input video. I tried to add timestamps (as numOfFrames) in encoded video as per following link but that didn't help.
Please tell me a way to synchronize both. This is my first time with FFMPEG or any multimedia libraries so any examples will be highly appreciated.
I am using directshow ISampleGrabber interface to capture those frames. Thank You
ISampleGrabber::SampleCB
. Each media sample has a time stampIMediaSample::GetTime
attached (it is optional, however it is almost always there, or it is a live feed). – Roman R.IMediaSample::GetTime
inSampleCB
is returningVFW_E_SAMPLE_TIME_NOT_SET
for me which means this sample is not time stamped. What should i do in this situation ? – Abhishek Bansal