[FFmpeg-user] kmsgrab: variable framerate captures (was: Oh man, this could be so great. But it's just... not.)

Adam Nielsen a.nielsen at shikadi.net
Sat Nov 20 16:43:08 EET 2021


> 2.) As far as I can tell, kmsgrab (like x11grab or other screen devices)
> wants a constant frame rate value (-r).
> [...] This is exactly how camera input is
> recorded on mobile devices, as they're all variable frame rate, and it
> works fine. kmsgrab should do the same.

Wouldn't this work the same as camera devices that change frame rate
with exposure rate?  I'm using a Raspberry Pi camera that slows down
the frame rate as it gets darker, and using
-use_wallclock_as_timestamps seems to work for that.  I also combine it
with -vsync 1 to duplicate the frames so I get a constant FPS in the
output video but I think -vf fps would probably be better.  Maybe you
need to mess with the setpts or setts filters to get accurate timing
but I'm pretty sure it's all doable already.

At least I can produce a fixed-framerate video that runs at the correct
speed when taken from a variable-framerate V4L2 camera device, so it
should be similar, assuming of course kmsgrab only provides a frame
upon pageflipping or similar.  If it's just sampling the screen
contents at regular intervals then none of this will work and you'll
probably get bad tearing in the recorded video, so hopefully it's not
done that way.

Cheers,
Adam.


More information about the ffmpeg-user mailing list