2

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
4
  • How does "major frame stutter" manifest itself? I can imagine sync issues but I can't quite picture how anything major could come from a 1 part per 10000 rate error.
    – Jim Mack
    Commented May 12, 2016 at 0:12
  • Please show the complete console output from your ffmpeg command.
    – llogan
    Commented May 12, 2016 at 16:38
  • I just noticed this only happens on .mkv format. I'm updating information about this. Here's the paste: pastebin.com/yUbn1zrL
    – tildearrow
    Commented May 13, 2016 at 0:53
  • 1
    For recording to MKV, insert -vsync 0. Whatever rate the source supplies, MKV will encode the same timings.
    – Gyan
    Commented May 13, 2016 at 7:08

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.