[SOLVED] Incorrect FPS on VFR

Support forum for DGDecNV
Post Reply
User avatar
Morpheus
Posts: 14
Joined: Thu Mar 29, 2018 12:18 am

[SOLVED] Incorrect FPS on VFR

Post by Morpheus »

Hello,it's me again.Recently I have a problem.
I convert VFR to CFR by this way:
1.Remux MP4 to MKV by mkvtoolnixgui.CUE:All frames.
2.Use DGindexNV to make a dgi of the MKV.
3.Extract the timecode by gmkvextractgui.
4.Write a vpy.Convert VFR to CFR by the filter called "VFRtoCFR".
5.Encode.

But when I do Step 4,if I use DGsource(),FPS is incorrect.

MP4 source:
MP4.png
I get this video by Shadowplay.VFR video...you know....

MKV source:
MKV.png
VPY:
VPY.png
FPS-LWLibavSource:
LW.jpg
FPS-DGNV:
DGNV.jpg
You see...the fps sent by DGNV is wrong.FPS of this VFR video is 59.844,not 60.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

I need the MKV file. Please post a link to it, or ask for my FTP details.
User avatar
Morpheus
Posts: 14
Joined: Thu Mar 29, 2018 12:18 am

Re: Incorrect FPS on VFR

Post by Morpheus »

User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

I looked into this a bit. LWLibavSource() reads some time codes from the start of the file and calculates a frame rate from them.

I do not intend to do anything like that. I have seen many cases where the calculated rate is not correct because a single bad frame duration at the beginning of the file makes the calculation think the file is VFR when it is really not. I call it VFR in name only.

viewtopic.php?f=14&t=617&start=20#p7649

Continue with the following posts for more on it.

You'll have to use AssumeFPS() if you want to override the stream's reported frame rate.

I am willing to look at the MP4 or MKV to see if it is indeed one of the cases I mentioned above.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

Sorry, I can't easily check the timecodes for MKV. If you can give me the MP4 I can easily check if it is VFR in name only, and if it is I'll be able to prove it to you.
User avatar
Morpheus
Posts: 14
Joined: Thu Mar 29, 2018 12:18 am

Re: Incorrect FPS on VFR

Post by Morpheus »

admin wrote:
Thu May 17, 2018 1:16 pm
Sorry, I can't easily check the timecodes for MKV. If you can give me the MP4 I can easily check if it is VFR in name only, and if it is I'll be able to prove it to you.
Videos created by shadowplay may be VFR. Sometimes is VFR,sometimes is CFR. If the performance of GPU is not enough,the video will be VFR.
If I use NVENCC to encode this MP4,the video and audio will not be synchronous.So I affirm this MP4 is a VFR video.

Emmmm,wait a moment....
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

OK, makes sense. With the MP4 I can determine the truth of the matter.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

An observation about the MKV file:

stream frame rate = 60000 / 1000 = 60 fps
MKV container frame rate = 59.96 fps (should be 59.94 or 60, so this is strange)

Currently, if the stream gives a frame rate, I use it. If it doesn't then I use the container rate. We could consider changing this.

How and why did you make a stream like this?
User avatar
Morpheus
Posts: 14
Joined: Thu Mar 29, 2018 12:18 am

Re: Incorrect FPS on VFR

Post by Morpheus »

admin wrote:
Thu May 17, 2018 1:42 pm
An observation about the MKV file:

stream frame rate = 60000 / 1000 = 60 fps
MKV container frame rate = 59.96 fps

Currently, if the stream gives a frame rate, I use it. If it doesn't then I use the container rate. We could consider changing this.

How and why did you make a stream like this?
The MP4 file has already uploaded.Still that link.The MP4 file is in RAR which has a Recovery record.It makes sure that the file will not be damaged when uploading and downloading.

Screen recording softwares create VFR video if the performance of CPU or GPU is not enough.Shadowplay is a attachment of NVIDIA Geforce Drivers.It encodes video by Nvenc(GPU).When I play games(like Dark Soul 3),GPU may be fully loaded,so that there is not enough performance given to shadowplay. So the video is unable to reach Pre-set 60fps.It may be 59.xx fps or lower.

I must sleep now.I will reply you tomorrow.Forgive me= =。
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

OK, thanks. Sleep well and we'll continue on the morrow.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: Incorrect FPS on VFR

Post by admin »

Here is what I found:

Almost all of the frame durations are fairly close to 16.67 ms. This is 60 fps as encoded in the stream. The variation around 60 fps is jitter.

The only exception is the 13th frame with a duration of 288 ms, likely due to a lag in the encoder. I don't know if a longer capture may have more of them. Let's suppose it does. Since you talk about audio desync, I suppose the audio doesn't also get lagged.

When I calculate the effective frame rate with all the frames it is ~58.84. When I exclude the one long frame, it is ~59.96. That could be either 59.94 or 60 fps; the stream is not long enough to be sure.

IMHO, the fully correct way to handle this would be to set it as 60 fps and then delay the audio at each lag point (assuming that the audio is not also lagged!). But this would require custom code. So setting the false lower frame rate 58.84 makes the video and audio lengths the same but doesn't really fix the sync in a correct way. It won't drift out of sync but every point of the file will be a little out of sync.

I'm not going to do anything about this. You'll have to use AssumeFPS() if you want to deviate from the stream's encoded frame rate.
User avatar
Morpheus
Posts: 14
Joined: Thu Mar 29, 2018 12:18 am

Re: Incorrect FPS on VFR

Post by Morpheus »

admin wrote:
Thu May 17, 2018 3:09 pm
Here is what I found:

Almost all of the frame durations are fairly close to 16.67 ms. This is 60 fps as encoded in the stream. The variation around 60 fps is jitter.

The only exception is the 13th frame with a duration of 288 ms, likely due to a lag in the encoder. I don't know if a longer capture may have more of them. Let's suppose it does. Since you talk about audio desync, I suppose the audio doesn't also get lagged.

When I calculate the effective frame rate with all the frames it is ~58.84. When I exclude the one long frame, it is ~59.96. That could be either 59.94 or 60 fps; the stream is not long enough to be sure.

IMHO, the fully correct way to handle this would be to set it as 60 fps and then delay the audio at each lag point (assuming that the audio is not also lagged!). But this would require custom code. So setting the false lower frame rate 58.84 makes the video and audio lengths the same but doesn't really fix the sync in a correct way. It won't drift out of sync but every point of the file will be a little out of sync.

I'm not going to do anything about this. You'll have to use AssumeFPS() if you want to deviate from the stream's encoded frame rate.
Okay.I will use AssumeFPS().Indeed,it is a problem of shadowplay,not yours.

Thanks.
Post Reply