Hitfilm is removing frames

logster6 Posts: 3 Just Starting Out
edited December 2020 in HitFilm

Hitfilm is doing something odd. I have two clips from Minecraft. The first video (Quality Test 5) is a clip of gameplay that was exported (1080p 60fps) from hitfilm. The second video (Quality Test 4) is a clip of gameplay that was directly taken from OBS (my recording software). Ignoring the bitrate issues, you can see that quality test 4 has a much better framerate than quality test 5.

Quality Test 5: https://www.youtube.com/watch?v=-bRNx9_MiYw&feature=youtu.be

Quality Test 4: https://www.youtube.com/watch?v=jW--pszR5zM&feature=youtu.be

Upon further inspection (by going frame by frame in the editor) the program appears to be skipping every 2 frames, and it doubles the last frame. For example, assume frames are in segments of 3 next to each-other:

Normal: 123 123 123 123...

Mine: 122 122 122 122...

The files play at the same speed, the editor seems to be consistently repeating this pattern.

Any idea as to what could be going on? My framerate in project settings is set to 60fps, and my video is set to 60 fps. Any help would be greatly appreciated. Thanks in advance.

Best Answer

  • Triem23
    Triem23 Posts: 20,062 Ambassador
    edited December 2020 Accepted Answer

    Chances are your screen recorder is giving you variable frame rate videos. Hitfilm will try to confirm it, but it can cause issues. If correct, the solution is to transcode before import to Hitfilm.

    Can you download MediaInfo (it's free), generate a Tree report of one clip from each recorder and post that here? That will verify if VFR is the issue.

    MediaInfo tutorial

    Assuming VFR is the issue, this video will discuss codecs - including VFR issues, but, about 19 min in gets into transcodes with several tools.

    Now, for your EXISTING videos, once you've transcoded, open your original project, right click media clips in the media bin and select "Relink." Choose the transcoded clip and that will swap the original for the transcode on the Timeline. You'll need to step through, look for timing drift and make some adjustments, but it will preserve most of the edit so you don't have to start from scratch. A little Slip tool here and there and everything should be fine.

    For future videos, if you drill into OBS you can force it to Constant Frame Rate, but Variable is the default. Changing the OBS settings should eliminate future transcodes...


  • spyresca
    spyresca Posts: 212 Enthusiast

    Yeah, once you get OBS set up correctly (variable bit rate, constant frame rate) the output works great in HF.

  • logster6
    logster6 Posts: 3 Just Starting Out

    I am sorry for the late reply (and I'm not sure if this is how to do it) but when converting the file to mp4 from obs, it will always change from a constant framerate to a variable framerate. I'd rather not use handbrake every time... and no one could help on the OBS Discord (aka where you ask for help). Not sure what to do here...

  • TerryS
    TerryS Posts: 127 Enthusiast

    You could record directly to mp4 from OBS and set up constant frame rate to boot. If thats what you want to do.

    Along with many other parameters. Just go into settings.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast


    You could record directly to mp4 from OBS and set up constant frame rate to boot. If thats what you want to do.

    In your screenshot you highlighted CRF. Your text mentioned setup of constant frame rate. That CRF setting is not constant frame rate. It is constant rate factor. A bitrate/quality mode of the x264 encoder. A CRF setting of 30 is a somewhat low visual quality in x264. Content depending of course.

  • TerryS
    TerryS Posts: 127 Enthusiast


    Thanks, I stand corrected. I don't use OBS but I have it installed on my computer. The small print got me.

    I think exporting as mp4/H264 may help? It might be worth a try.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast

    MP4 container output from OBS is always a constant frame rate file.

  • logster6
    logster6 Posts: 3 Just Starting Out

    The reason I never wanted to record mp4 in OBS is because of the instability. If the program crashes or I forget to stop the recording, the mp4 is gone. Though, at this point that risk might be the best option... I'll just have to be careful.

    Thank you everyone for your time and help, I appreciate it!

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast
    edited January 22


    If you are using a program that crashes frequently, should you be using that program. But you gotta do what you gotta do.

    You can get OBS to output a fragmented MP4 via custom muxer options. I very briefly tested that once upon a time. In OBS the MKV is by default "fragmented". The MP4 is not. In other words an MKV has the same "issue" as MP4 if the MKV is not fragmented. In a crash, you always lose the last fragment. e.g. If the fragment length is 1 hour, then you lose the last hour of a recording. Fragment lengths used IRL are usually quite short.

    OBS captures constant frame rate video. When remuxing the MKV to MP4 there is an issue with the timebase chosen for the MP4 and this causes the muxer to output what I call an alternating frame rate. A two frame pattern. One shorter and one longer. The average of the two is the "constant" frame rate. Technically an average frame rate. You are never more than fraction of a frame duration off with audio. A little under/over, then perfect, and repeat. edit: Three frame patterns are also common.

    I wish OBS would support a check option for fragment MP4s. I briefly tested Hitfilm with a fragmented MP4 and it seemed to handle it just fine. Apparently a lot of apps do not. At least historically.

    At a certain version Hitfilm tired to handle VFR media. That feature works like crap. And guess what, it makes Hitfilm not "handle" alternating frame rate media properly. Old Hitfilm, or any editor that ignores VFR frame rates, will handle alternating frame rate media just fine (so to speak). I'm sure one can find boundary conditions but right now the whole thing gets borked. Basically 100%.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast
    edited January 22

    At a closer look the variable frame rate MP4 from a remux of a "constant" frame rate MKV is a literal translation of the MKV. I knew MKV was different but I did not think it this limiting.

    If an MKV file is 25 or 50 fps it can literally be a constant frame rate. It is flat out not possible to have a 23.98, 24, 29.97, 30 , 59.92 or 60 fps constant frame rate MKV file. Literally. At least my reading at this time.

    MKV has a fixed 1ms timebase. 60.0 fps is 16.666666667 ms. MKV can only encode 16ms or 17ms. So in an MKV file at 60.0 fps there is a pattern of some 16ms frames and some 17ms frames and the average of the pattern gives 16.66667ms. MOV/MP4 have no such limitations. The remux to MP4 is a literal translation of the MKV contents. This limitation could very well be a reason video editors have shined away from MKV. Close counts in horseshoes, and also video playback. Not so much is video editing.

    So any tool that reports a constant frame rate for most MKV except 25 and 50 fps is wink, wink lying. They know the MKV limitation and are wink, wink computing the average and telling you that. If they detect a pattern. Since MOV/MP4 have no such limitation the tools, e.g. MediaInfo, are telling us literally what is there. Of course, MediaInfo is also giving us the computed average of the pattern as well for MOV/MP4.

    Close is not so good for editing, but an app like Hitfilm could, wink, wink treat a short pattern frame rate as constant (the average) and that "close" could work. The patterns are typically 2, 3 frames.

    Since MOV/MP4 do not have said limitation and can encode a true constant 59.94 or 60 fps file, then if the media is not constant, then there must be some reason for that. So tools report as such.

    I've not yet found a way to get ffmpeg to remux a constant (wink, wink) MKV to a constant (true) MOV/MP4. It may not exist. Of course, a transcode certainly always works. Maybe Hitfilm should do the wink, wink thing. You are only ever off by a fraction of a ms within the middle of the pattern.

    Then there are lazy apps like handbrake that generate pattern muxed files in MOV/MP4 when they do not have to. In the HB case 23.98, and 59.94 have issues. Least that I have tested. But I digress.