0

I know that combining -vsync vfr and -r 30 sets a ceiling to the number of frames in the output. But how do you specify a minimum framerate that should always be produced?

As part of an encoding pipeline, I'm potentially receiving inputs that have a very sparse frame rate. In the example below, you can see that the framerate drops below 1 and sometimes a frame correspond to nearly a whole minute. This particular example was produced by Chrome using the MediaRecorder API recording the Chrome window itself. My guess is that Chrome only produces a frame when there is a change on screen, e.g. when the mouse moves, resulting in such low framerates. Further down the encoding pipeline, I have seen severe image degradation because of this.

As the encoding pipeline should deal with various inputs – constant and variable framerate videos – I was hoping that there is a general solution to duplicate and drop frames such that the output framerate is between say 25 and 60.

$ ffprobe -hide_banner -show_entries frame=best_effort_timestamp_time -sexagesimal -of default=nokey=1:noprint_wrappers=1 input.mkv | head -n 30
Input #0, matroska,webm, from 'input.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:06:10.38, start: 0.000000, bitrate: 243 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1048, SAR 1:1 DAR 240:131, 30.30 fps, 30.30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      DURATION        : 00:06:10.383000000
0:00:00.000000
0:00:02.893000
0:00:04.489000
0:00:04.560000
0:00:04.646000
0:00:04.721000
0:00:04.799000
0:00:04.831000
0:00:04.902000
0:00:04.970000
0:00:05.099000
0:00:05.160000
0:00:05.234000
0:00:05.529000
0:00:05.599000
0:00:05.668000
0:00:06.302000
0:00:06.373000
0:00:07.151000
0:00:07.177000
0:00:07.259000
0:00:07.341000
0:00:07.463000
0:00:07.534000
0:00:07.605000
0:00:09.548000
0:01:03.862000
0:01:03.969000
0:01:04.040000
0:01:04.110000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.