ComfyUI Node

Detect VFR

Detect VFR — is your footage secretly variable-framerate? Ask before you convert

By LaserDog80·Created 4 months ago·Updated 4 months ago· 0
Detect VFR
    • is_vfr
    • message
    video_path

    The most common cause of "my converted video's audio is out of sync" isn't a bad node or a bad encoder. It's variable framerate (VFR) footage. Phones record it, some screen recorders produce it, and a lot of AI exports declare one framerate while actually playing another. If you feed that into a conversion that assumes constant frames, the audio drifts and nobody's happy.

    Detect VFR is the little diagnostic node in the Framerate Converter pack (Trope Tools, TropeMedia) that tells you, up front, whether you're about to have this problem. One string input, two outputs, zero guesswork.

    How it knows

    It runs ffprobe on your video_path and pulls two numbers from the video stream: r_frame_rate (the nominal rate from stream timestamps) and avg_frame_rate (total frames ÷ playback duration). On constant-framerate footage these agree. On VFR footage they diverge - the nominal rate is the LCM of all the varied timestamps, while the average reflects reality.

    If they differ by more than 0.5 fps, it flags is_vfr as True and the message output explains the situation:

    Variable framerate detected: base=60.000fps, avg=23.976fps.
    Consider converting to CFR first.
    

    The message output is a string, so drop it into a Show Text node or just read it off the node's display. The boolean is what you'd actually branch on.

    Why you care

    In the pack's own troubleshooting notes, the fix for audio desync after conversion is literally: check whether the source is VFR, and if it is, normalize it to constant framerate before converting. This node is that check. A typical mini-workflow:

    1. Probe Video (or just this node) on the source.
    2. If is_vfr is true, normalize the clip to CFR first.
    3. Then run Convert Framerate with audio_mode: preserve_pitch.

    You can even route the boolean into a conditional node and only proceed when the footage is clean, though for most people a single run to check is enough.

    Install and notes

    Same pack install as everything here: ComfyUI Manager → search Trope Tools - Framerate Converter, or git clone https://github.com/LaserDog80/ComfyUI-FramerateConverter into custom_nodes/ and restart. It depends on the system ffprobe binary (bundled with FFmpeg - install it via brew install ffmpeg, apt install ffmpeg, or the gyan.dev Windows build), and it'll raise a clear error if ffprobe can't read the file.

    One honest caveat: a 0.5 fps threshold is a heuristic, not gospel. Mildly irregular footage can sneak under it, and a badly-labeled constant-framerate file can occasionally trip it. Treat it as a smoke test, not a lab instrument. For the vast majority of phone recordings and oddball AI exports, though, it's dead-on - and knowing before you burn a conversion on a VFR source is worth the two seconds it takes.

    CategoryTrope Tools/Framerate Converter/Inspect

    Inputs (1)

    NameTypeDefaultDescription
    video_pathSTRING

    Outputs (2)

    NameTypeDescription
    is_vfrBOOLEAN
    messageSTRING