How Can I Make Sure That The Frame Rate Is "Constant"?

Hello. :slight_smile:

I was exporting a project as a matroska AKA mkv file (I picked the first one listed as there are two listed apparently in error) but when the file finished and I was looking at the specs, it came back with the info in Media Player Classic saying that the Frame Rate Mode is Variable instead of my preferred Constant. The original file is not Variable it is Constant.

How do I make sure that the export file comes out as Constant instead of Variable? Programs like Handbrake have an option for it but there doesn’t seem to be one in here.

I’ll give more info in case any of this is the reason why it changed the Frame Rate Mode to Constant: The Frames Per Sec automatically showed up at the Video tab in Export as “30.303”. I left it that way even though it seemed a little odd and when I checked the finished file I see that the info for the frames in Media Player Classic lists the FPS as “286fps”. Don’t know why that is or what that means. Also, I had always left the below options in the Video tab alone since I don’t understand them but I decided to change one to experiment. At the “Interpolation” option, I always left it at the default which was “Bilinear” but this time I changed it to “Hyper/Lanzcos” because it notes that it is “Best” in parenthesis.

Also, in the Codec tab, right next to GOP frames there is a checkbox for “Fixed” which I never really payed attention to before. In this project I left it as it was which was unchecked. Is that the option for which Frame Rate Mode it is going to produce?

Thanks in advance!

The “Fixed” checkbox next to GOP is for fixed-GOP. Shotcut only exports as constant frame rate. Your problem is more a problem of getting the libraries to construct the Matroska output correctly. If you are not using one of the Export presets and doing anything more than adjusting bitrates and quality settings, you must be rather an expert and Shotcut is not good about preventing you from shooting yourself in the foot in this area. :wink:

I tried to reproduce by using Export defaults and changing only Format to mastroska, and it worked OK for me using MediaInfo 0.7.91 - it reports constant frame rate at same rate as I had in Shotcut Export. However, in Media Player Classic 1.7.10 > Properties > MediaInfo, it says variable frame rate. I suspect that MediaInfo integrated into MPC-HC is old and incorrect.

The “Fixed” checkbox next to GOP is for fixed-GOP

And what’s “GOP”? What does that mean and do?

Shotcut only exports as constant frame rate

Not for these. I just used MediaInfo on the files to check and they also said Variable. So there is something going on here with Shotcut. This happened when I tried to export them as mkv files. I am going to try mp4 and see what happens.

If you are not using one of the Export presets and doing anything more than adjusting bitrates and quality settings, you must be rather an expert and Shotcut is not good about preventing you from shooting yourself in the foot in this area

Well, all I want is that the files come out the same quality as the original. So I just try to match the bitrates as they show up in the original files. :slight_smile:

So I just checked by taking one of the files and exporting it to mp4 keeping the exact same settings and it resulted in the file now being Constant.

This means that there is a bug in Shotcut that when it exports as mkv it exports it as Variable Frame Rate instead of Constant.

Will this be fixed for the next version of Shotcut?

The tool you are using to get info about Matroska is incorrect. MPC-HC integrates another tool called MediaInfo that is old. The latest standalone version of MediaInfo reports the Matroska output as constant frame rate.

Here is the MPC-HC Changelog: https://mpc-hc.org/changelog/
It says "Updated: MediaInfoLib to v0.7.75"
The latest version of MediaInfo is v0.7.91.

Did you not read what I wrote? I told you in my reply before the last one that I did indeed used MediaInfo (not through MPC) and it still said the Frame Rate Mode is “Variable”. And yes, it is the latest version of MediaInfo.

If Shotcut is only supposed to export as Constant then there is a bug that it exports it as Variable when it has to do with mkv files. I already tested this with a couple of projects that I exported as mkv.

I reproduced the problem by using the default Export settings and changing only Format to matroska. Shotcut just uses FFmpeg (v3.0) libraries to encode and mux, and I do not know what is tripping it up. When I use the HuffYUV preset, which uses Matroska, I get constant framerate. Maybe in previous tests I used that preset. I also get constant framerate output with WebM, which is based on Matroska. Seems to be a problem with certain codecs. Regardless of the flagging or what MediaInfo reports, the output is constant frame rate in that sense that each frame has the same duration. That is what I meant before when I said Shotcut only exports constant - the engine has no support for variable framerate.

I took a brief look at the Matroska-writing code in FFmpeg, and it was not clear how to fix or change something. In further testing today, I was back to not being able to reproduce it! Besides the codec selection, it turns out that using a Settings Video Mode of 1280x720 makes it constant framerate in MediaInfo for me. Tests using 1080p, 2160p, or 480i gave me variable. Strange. I would not be surprised if this is a problem with MediaInfo.

Next, I turned to some specialized Matroska tools mkvinfo and MKVToolNix to get another opinion. They suggest that there is nothing in the file to indicate the frame rate or frame rate mode - only a default video frame duration. That somewhat corresponds to my reading of the ffmpeg code and not finding it setting anything specific in this regard. This seems to be more a side effect of the heuristic MediaInfo uses to indicate a mode.

In fact, I just made ffmpeg command line tool output a variable frame rate mkv by setting the audio codec to aac (defaults to vorbis). Now, I will do a test in Shotcut, not at 720p, but using vorbis audio codec… Well, low and behold, constant frame rate.

Thanks for the taking the time to investigate it.

Will a fix be coming?

No, there is nothing to fix. Nothing in the Matroska file indicates frame rate mode. It is a fault of MediaInfo’s having a bad heuristic for determining constant vs variable frame rate for Matroska.

First you said it was a problem with MPC. Now you’re saying that it’s a problem with MediaInfo? Even though according to you yourself, you ran tests that demonstrated inconsistencies with how Shotcut is exporting files? :confused:

It’s pretty obvious it’s a problem with Shotcut.

And I already explained that MPC uses MediaInfo to report the info. And I explained that the Matroska file does not say itself what the frame rate mode is and showed that MediaInfo is the one exhibiting the inconsistency. I also explained that setting the vorbis audio codec makes MediaInfo believe/report that it is constant. I can’t help that MediaInfo chooses to think that using the aac audio codec makes it variable. I don’t really care what you think about Shotcut. You can use something else.