Matroska format's framerate is not accurate with certain values If the Matroska format is used, in certain framerates it doesn't record at exact input framerate, but rather at a little higher than the input framerate.

As an example:

ffmpeg -video_size 1920x1080 -f x11grab -framerate 30 -i :0.0 -c:v libx264rgb -crf 0 -preset ultrafast video.mkv


doesn't generate a recording at 30fps, but rather at 30.0003fps.

This is not good, because even a slight change in input framerate can cause major frame stutter. Unless ffmpeg is speeding up the stream by 1.00001x, which I don't think so when using x11grab.

To prove this, VLC can be used for checking the frame rate.

Is there any way to force exactly 30fps, or is this a format flaw?

Also, uname -a:

Linux linux 4.1.15-rt17-1-rt-fixedtimers #1 SMP PREEMPT RT Sat Jan 16 01:14:52 GMT+5 2016 x86_64 GNU/Linux
MKV does not store a frame rate in its container. So ffmpeg/vlc looks at the default duration of a frame instead. It sees 33.333ms and does the math, which is where your weird number comes from. 

For more information, see: https://gitlab.com/mbunkus/mkvtoolnix/wikis/Wrong-frame-rate-displayed

To test this out, you can run ffprobe with -show_frames. I think you'll find the presentation times for each frame are spot on.