How to completely avoid variable framerate in the video recording?

Galach

New Member
Hello! I recently started using OBS with dual PC setup instead of shadow play. One of the reasons was constant frame rate. Most of the time it works perfectly ffmpeg analysis shows VFR - 0.0000. But sometimes, especially when I turn on/off replay buffer while recording or just for unknown reason OBS records 1 frame in VFR and ffmpeg detects that. Is it normal? Or maybe I can avoid this somehow... I'd like to. Now I'm using comon fps values in video settings. Maybe I should use integer?
Btw what really do this fps values settings (common, integer, fractional)
 

Attachments

  • vfr вылез.png
    vfr вылез.png
    101.8 KB · Views: 334

FerretBomb

Active Member
Can you post a logfile from a recording session where this occurred? We can take a look.

Common FPS values: Just that. The most common framerates used. Convenient!
Integer: Full integer values, most commonly (and included above) 30fps, and 60fps.
Fractional: For proper recording at legacy Analog NTSC 23.976, 29.97 and 59.94fps (which all need to be kicked into a fire and die as soon as possible), a fractional value like 30000/1001 is more precise than using decimal entry. Some people think that using 60/1 fractional will do anything to the recording (and several YouTube 'best settings guides' parrot this misinformation because the creators don't know any better), but OBS treats it identically to just using 60fps.
 

Galach

New Member
Can you post a logfile from a recording session where this occurred? We can take a look.
I'll try to catch it. That's not easy because I don't know for sure that recording has VFR till I make FFmpeg analysis. Stats can show 0 dropped frames but VFR anyway appears. But more often surely it appears when I use recording pause or turn on/off replay buffer and cause some dropped frames after that.

Where can I save logfile?
 

FerretBomb

Active Member
I'll try to catch it. That's not easy because I don't know for sure that recording has VFR till I make FFmpeg analysis. Stats can show 0 dropped frames but VFR anyway appears. But more often surely it appears when I use recording pause or turn on/off replay buffer and cause some dropped frames after that.

Where can I save logfile?
There's a thread pinned at the top of the forum with instructions on how to grab a diagnostic logfile.
One of the big things is, are you recording directly to MP4 with OBS? The direct-record MP4s it outputs tend to be... a bit problematic, in a lot of cases. Likewise, are you using the ffmpeg output, software x264, x265, or NVENC encoding stack? The log should have all that information, along with things like the timing tree, any delayed/skipped frames, and other config data.
 

Galach

New Member
There's a thread pinned at the top of the forum with instructions on how to grab a diagnostic logfile.
One of the big things is, are you recording directly to MP4 with OBS? The direct-record MP4s it outputs tend to be... a bit problematic, in a lot of cases. Likewise, are you using the ffmpeg output, software x264, x265, or NVENC encoding stack? The log should have all that information, along with things like the timing tree, any delayed/skipped frames, and other config data.
I'm recording MOV via Nvenc. I'll try to catch log tomorrow.
Also I wanted to ask about fractional fps. Sometimes I need to record 29,97 and 59,94fps to match video with my camera footage (it can shoot only this types of framerate). Which values I should set for them?
 

Galach

New Member
Also interesting to hear your opinion about recording formats. OBS pushes to use mkv and convert it later, but I never tried that and have some fears about potential problems and quality loss with changing format. That's why for now I stoped on mov, it suits good for my further edit workflow
 

Harold

Active Member
but I never tried that and have some fears about potential problems and quality loss with changing format.
If you're using OBS' built in remux function to remux an MKV to MP4, those fears are 700% unfounded.

MOV and MP4 both have similar problems as MP4 is based on MOV.
 

FerretBomb

Active Member
Also interesting to hear your opinion about recording formats. OBS pushes to use mkv and convert it later, but I never tried that and have some fears about potential problems and quality loss with changing format. That's why for now I stoped on mov, it suits good for my further edit workflow
It isn't opinion.
MP4, MOV and MKV are container formats. Remuxing just rewraps the videostream in one of the other containers. Zero quality loss.
MP4 and MOV store the metadata atom at the end though, meaning if ANYTHING goes wrong during recording, the recording is permanently and 100% irrecoverably corrupted as it won't receive the finalization it needs to be complete and playable. There are 'recovery tools' out there, but they only work properly with a clonable atom... which won't exist for a live recording, which are always variable to a certain extent.

Remuxing from MKV to MP4/MOV also can result in a cleaner rewrap structure and indexing, which means that video editing suites will be able to ingest them and scrub with fewer issues. Premiere, Vegas, Resolve, and a few others are notorious for absolutely screwing up BADLY when handed direct-record MP4 or MOVs from OBS, even to the point of completely crashing.
So if that's your underlying issue? Recording to MKV and remuxing to mp4/mov is how you fix it, not worrying about one-off VFR hits from an ffmpeg inspection pass.


As far as fractional values, make sure that your video capture device can capture at fractional rates properly. Many cannot, and jerking back and forth from the fractional source feed, to an integer capture rate, BACK to a fractional rate will just increase judder significantly over just capturing integer and recording integer.
If your capture device 1000% can, then it depends on your source rate. 30000/1001 or 60000/1001 as applicable, per analog NTSC spec.
Still want that crap to be kicked in a hole, buried, and forgotten as soon as possible. We aren't even broadcasting analog any more, and every TV has been full-integer signal ready for at least 15 years now. There is ZERO need for it beyond "we've always done it this way".
 

Galach

New Member
If your capture device 1000% can, then it depends on your source rate. 30000/1001 or 60000/1001 as applicable, per analog NTSC spec.
Still want that crap to be kicked in a hole, buried, and forgotten as soon as possible. We aren't even broadcasting analog any more, and every TV has been full-integer signal ready for at least 15 years now. There is ZERO need for it beyond "we've always done it this way".
Totally agree. I don't know why my camera can't record pure 30 and 60 fps. As capture device I use avermedia live gamer bolt. It must be capable to record this tyes of framerate.

Remuxing from MKV to MP4/MOV also can result in a cleaner rewrap structure and indexing, which means that video editing suites will be able to ingest them and scrub with fewer issues.
Does OBS support remuxing to MOV? I thought only in mp4.
 

Galach

New Member
Can you post a logfile from a recording session where this occurred? We can take a look.
Captured really interesting log file. I tested mkv with remux and just MOV recording. As a result first got 60% vfr and second 1 frame vfr. Logs and screenshots here - https://obsproject.com/logs/OZsiw1ICncVAS8vz
P.S. I made recordings on my main PC, capturing his own screen connected by DP and for some reason has 59,997hz. Usually I use a laptop with capture card
 

Attachments

  • no remux 1 frame.png
    no remux 1 frame.png
    96.4 KB · Views: 87
  • remux.png
    remux.png
    98.7 KB · Views: 86
Last edited:

Galach

New Member
Changed DP to HDMI to get pure 60hz. Made tests again and for remuxing there is same problem - VFR. MOV now showed clearest result but I still not sure that refresh rate made that but random - https://obsproject.com/logs/0xCX0xUE5aiUVRpa
 

Attachments

  • mov on 60hz.png
    mov on 60hz.png
    83.6 KB · Views: 26
  • remux on 60hz monitor.png
    remux on 60hz monitor.png
    87.3 KB · Views: 26

Galach

New Member
Finally tested my full dual PC setup with capture card and laptop. Same problem with remuxing - variable framerate. MOV - constant framerate. Stats window always showed 0 dropped frames and there are no lack of performance from GPU.
Log - https://obsproject.com/logs/9iGXGPY-VI6hmNop

So, do my fears of remuxing have some foundation now?
 

Attachments

  • remux dual pc.png
    remux dual pc.png
    103.6 KB · Views: 30
  • MOV dual PC.png
    MOV dual PC.png
    95.1 KB · Views: 30

FerretBomb

Active Member
Totally agree. I don't know why my camera can't record pure 30 and 60 fps. As capture device I use avermedia live gamer bolt. It must be capable to record this tyes of framerate.
Never simply assume, when you're operating on this level, and using a consumer-grade card. Heck, don't assume even if you're using a prosumer or studio card. Check the product whitesheets, when you're getting this in-detail.
I took a peek at them and it appears that for 2160p, 1440p, 1080p, 720p, 480p, and 640x480 it does support decimal rates (and does not specify fractional, but close enough), but only supports integer capture for any other of its supported resolutions.

Finally tested my full dual PC setup with capture card and laptop. Same problem with remuxing - variable framerate. MOV - constant framerate. Stats window always showed 0 dropped frames and there are no lack of performance from GPU.
Log - https://obsproject.com/logs/9iGXGPY-VI6hmNop

So, do my fears of remuxing have some foundation now?
Interesting results... which shouldn't happen. In your case, then yes. OBS should be defaulting to CFR mode (the VFR mode switch formerly in Settings->Advanced was actually removed entirely from the UI at some point), but for some reason is not in your case.
I'm still mildly curious what underlying issue you're looking to solve that needs locked CFR. And if it's video editor scrubbing or ingest issues (which is the usual one), if you've tested the remuxed video files, even with the VFR present.

Additional testing steps:
-When using NVENC, use the Quality preset, not Max Quality (you are not, just including for completeness). Disable Lookahead and Psychovisual Tuning. They cause problems even in otherwise perfect setups. B-frames should never go over 2, unless you're playing an EXTREMELY low-motion game (I've seen 4 being used A LOT lately, where did you get this value from?). Recording should be done using CQP, not CBR. CQP does quality-target encoding to maintain a given image quality level. 22 is 'good', 16 is 'visually lossless'. 12 can be used when the output will be edited later, to minimize re-encoding artifacts, but will result in VERY large files. Below 12 should not be used unless having a specific reason. (cqp is how far the encode is allowed to deviate from 'perfect' uncompressed video; the lower the value, the larger the file, but the better the quality)

-Do these issues persist only with NVENC? Are you able to test with x264 Software encoding? HEVC x265? I ask because NVENC does present some other erratic issues on some setups (notably audio desync with multi-track audio in recordings for some reason, but not with single-track).
 
Last edited:

Galach

New Member
I'm still mildly curious what underlying issue you're looking to solve that needs locked CFR. And if it's video editor scrubbing or ingest issues (which is the usual one), if you've tested the remuxed video files, even with the VFR present.
I haven't tested VFR files yet, but heard a lot complains from people to audio desync. Couple years ago edit programms didn't open VFR files at all but now they, as far as I know open them and use auto feature which "creates" lacked frames and fixes audio desync. Which looks like just creeating CFR video from VFR sourse file. Also I'm working with proxy files (4k h264 is really hard files for editing even on 3090), so there people advice to use CFR files for reliable results.


I've seen 4 being used A LOT lately, where did you get this value from?
This value always goes with "lookahead on" which must automatically choose b-frames for the scene. It helps to get more quality in low motion scenes (because encoder can push b-frames to 4 in auto mode). I got this from official Nvenc Guide for OBS from Nvidia. Cople tests and camparisons woth 2 b-frames without lookahead didn't showed any problems.

Do these issues persist only with NVENC? Are you able to test with x264 Software encoding? HEVC x265?
I didn't test them yet because thought that my laptop's cpu won't handle as good 4k60 recording as my GPU can with nvenc.

Recording should be done using CQP, not CBR. CQP does quality-target encoding to maintain a given image quality level. 22 is 'good', 16 is 'visually lossless'.
I've tested CQP 16 and found that after uploading on youtube there are no visible difference between it and CBR 300k, but file sizes with CQP 16 were much bigger (700k bitrate). They are better in raw footage, but I'm interested only in real youtube performance, thats why switched to CBR: it gives twice less file sizes and behaves more predictible in replay buffer function. But maybe I'll try CQP 22 if it will give same size.
 

Galach

New Member
-Do these issues persist only with NVENC? Are you able to test with x264 Software encoding? HEVC x265? I ask because NVENC does present some other erratic issues on some setups (notably audio desync with multi-track audio in recordings for some reason, but not with single-track).
Tested x264. Same results. Looks like mkv always captures VFR from PC.
Log- https://obsproject.com/logs/HCwVYssyNqv22Zmt
 

Attachments

  • x264 mov.png
    x264 mov.png
    102.3 KB · Views: 73
  • x264 remux.png
    x264 remux.png
    105.3 KB · Views: 73
Top