FFmpeg encode variable input framerate I have a Qt application running, i hijack the openGL frameBuffer when a new frame has been rendered. A new frame is drawned when only some changes appear in the scene, so no constant frameRate.

Now i want to send those raw rgba pixels value to ffmpeg, I use this wonderfull link http://blog.mmacklin.com/2013/06/11/real-time-video-capture-with-ffmpeg/ to encode my input stream, but in the end i have a video where each frame has been concatenate with a constant time between each. 

To clarify, if i am not updating my application for 1 sec, this halt won't appear in the final video.

I use this command line to encode:

ffmpeg.exe -f rawvideo -vsync 1 -pix_fmt rgba -s 1172x768 -i - -threads 0 -y -pix_fmt yuv420p -b:v 8000K -vf vflip output.mp4


and i write in to my stream with:

uchar* buffer = (uchar*)malloc(count);
fwrite(buffer, sizeof(char), count, m_ffmpeg);
fflush(m_ffmpeg);


I saw the vsync option, i use it with different values as output and input options, but it seems to have no effect.

I might be able to store the delta time in a .txt file if it can help.
When receiving frames from a raw input i.e. one without embedded timestamps, ffmpeg will assign timestamps in serial order, thus losing the temporal relation between the incoming frames.

When the difference in times is important, you can add -use_wallclock_as_timestamps 1 before the input -i. This will assign the system time at time of receipt as the timestamp. Not perfect, as there may be jitter during the transport of the input, but better than the default behaviour.

vsync is somewhat of a misnomer. It takes effect after filtering and is generally used to select between generating a constant (cfr) or variable frame rate (vfr) stream.